Page 1 of 1
chanlleging problem, split gif easily ,no way to recombine
Posted: 2010-10-07T20:58:45-07:00
by gefferey
i have used convert "spring festival.gif" sf_%d.gif to split it, but when i want to recombine them ,i could not get the original result, i dont know why. and i use convert "spring festival.gif" -coalesce +adjoin sf_%d.gif ,i get different gifs from the above ,and also i could not recombine them to get the orginal one. can anyone help me out ?
i tried to watermark this gif, use "convert sf.gif -coalesce -gravity center -geometry +0+0 null: -draw "gravity north fill black text 0,12 'copyright'" -layers composite -layers optimize wmark_sf.gif" but error happens:Magick: missing Null Image List Separator layers Composite @ error/mogrify.c/MogrifyImageList/8121. and i see the output wmark_sf.gif is totally different from the original one. i dont know why
Re: chanlleging problem, split gif easily ,no way to recombi
Posted: 2010-10-10T13:53:21-07:00
by fmw42
IM 6.6.4.10 Q16 (hdri) Mac OSX Tiger
I can verify that doing
convert spring_festival.gif -coalesce spring_festival_%d.gif
gives bad results for frames 1,2,3, but correct results for frame 0.
If I do the following I get a colormap error. So perhaps your image is corrupt in some way.
convert spring_festival.gif spring_festival_c.gif
convert: invalid colormap index `spring_festival.gif' @ error/colormap-private.h/ConstrainColormapIndex/34.
This works successfully, but all but the first frame are bad as described above (mostly red).
I am not an expert on gif format, but perhaps you should report this on the bugs forum. Or perhaps some one with more knowledge about gif animations might take a look and answer, such as Anthony.
Re: chanlleging problem, split gif easily ,no way to recombi
Posted: 2010-10-10T18:03:14-07:00
by gefferey
i got the first frame correctly too, the other three are mostly red and incorrectly. thank u for ur help
Re: chanlleging problem, split gif easily ,no way to recombi
Posted: 2010-10-10T18:30:03-07:00
by fmw42
I also get the same bad results going to png
convert spring_festival.gif -coalesce spring_festival_%d.png
Re: chanlleging problem, split gif easily ,no way to recombi
Posted: 2010-10-10T18:55:45-07:00
by gefferey
when i use ulead animator to split the gif, i got the correct four frames, i dont know why.
Re: chanlleging problem, split gif easily ,no way to recombi
Posted: 2010-10-10T20:59:47-07:00
by fmw42
I suspect that ulead is not making a correct colormap, per the example above of a simple convert and the error message.
Re: chanlleging problem, split gif easily ,no way to recombi
Posted: 2010-10-10T21:14:04-07:00
by anthony
I also see a good first frame and back later frames. this is nothing to do with coalesce, but with the GIF reading itself.
Using a old format specific program "giftrans"....
Animation has a global color table of 16 colors, with no transparent flag set for the first frame.
But then uses a Transparent color index (16) for the 3 later frames!
The problem is not with -coalesce but with IM GIF reading. The GIF coder is not handling a global color table with transparency off with later images that use that same color table, and transparency on.
Or perhaps the result is being overlayed on the normally unused background color (color index 0)
---------------------
This is the SAME bug I have reported (three times so far) with GIF reading, for the last few years.
That is when the GIF image (actually written by imageMagick this time) contains no transparency on the first frame and has transparency in later frames, IM fails to read it back into memory correctly...
For example...
First create a "Dispose Background" test animation
Code: Select all
convert -delay 100 -dispose none \
-size 100x100 xc:SkyBlue +antialias \
-fill DodgerBlue -draw 'circle 50,50 15,25' \
-dispose background \
-page +5+10 balloon.gif \
-page +35+30 medical.gif \
-page +62+50 present.gif \
-page +10+55 shading.gif \
-loop 0 canvas_bgnd.gif
Now make a
-layers Dispose version
Code: Select all
convert canvas_bgnd.gif -layers Dispose canvas_bgnd_dispose.gif
This animation works perfectly.... Showing transparency...
But if IM tried to read it (and write it again), all the transparency disappears!!!!
Code: Select all
convert canvas_bgnd_dispose.gif canvas_bgnd_dispose_rw.gif
The problem is ONlY in GIF reading, as after reading the images in memory (all fully coalesce already) do not show the transparency they should! As it displays correctly the write part of GIF coder is correct, in it only the READ that is failing.
Re: chanlleging problem, split gif easily ,no way to recombi
Posted: 2010-10-10T22:10:19-07:00
by gefferey
thx a lot . this problem confused me for a long time ,and now i know why.
Re: chanlleging problem, split gif easily ,no way to recombi
Posted: 2010-10-10T23:02:12-07:00
by anthony
Adendum... I al see an error that should not exist...
convert: invalid colormap index `spring_festival.gif' @ error/colormap-private.h/ConstrainColormapIndex/34.
this may be the best indication as to the transparency into global colormap problem.
Re: chanlleging problem, split gif easily ,no way to recombi
Posted: 2010-10-10T23:13:40-07:00
by anthony
I found that 'gifsicle', a very old GIF optimizer also generated the same wrong result!!!
The same goes for "gifview".
The question is why, when the web browser obviously gets it right!
Closer look....
The global color table in both images is exactly a power of 2.
16 for spring_festivel.gif and 2 for canvas_bgnd_dispose.gif
However the transparent color index is 16 and 2 respectively.
As such while these animations will display correctly, the actual color index for transparency does not actually point to a real color in the color table.
It may be that either the transpareny color index needs to ignore 'high bits' in which case the color index to use is '0' in both cases. Though I doubt that is correct.
OR the image data in GIF is using 8 bit indexes (one byte per pixel whne uncompressed) regardless of the color table, and just because transparency points to a non-existant color table entry does not make it an invalid color index. --
ANY ONE KNOW THE GIF SPECIFICATION?
That is the image data contains transparent indexes, but the color table does not, because the first image did not need it and it was a power of two in size already!
In any case it is obvious that the firefox browser understands this, even if ImageMagick, gifsicle, and gifview does not.
So the problem is multi-fold.
- A read problem: handling a transparent index outside colortable size
- A IM write problem: generating a invalid transparent index for too small a global colortable.
- Unless of course transparent indexes can be 'invalid'! After all you don't really need to have a valid transparent color, just a transparent index!
What created the "spring_festival.gif" image in the first place?
Do you have a valid source image somewhere?
Re: chanlleging problem, split gif easily ,no way to recombi
Posted: 2010-10-10T23:19:30-07:00
by gefferey
i dont have the source image, i downloaded the gif from the internet. it is really complicate problems as i know little about the colormap, but thank you very much for ur patience.