Gif manipulation side effect?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
redroom
Posts: 3
Joined: 2013-03-22T04:07:59-07:00
Authentication code: 6789

Gif manipulation side effect?

Post by redroom »

Hello,
I tried to convert that image to png :
Image
I used :
convert mn.gif test.png
The image is duplicated 4 times in some kind of image stack during the process...
The results shows me 4 squeezed maps of france in the same image size...
I'm using the latest imagemagick on windows XP.

If I'm converting the image from mn.gif to mn1.gif in paint .net and then do the convert, it works properly.
So I guess the original format has some strange settings that makes the convert fail, and that paint.net just ignores...

Should I set some additional parameters to avoid that ?
Thanks for ur help.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Gif manipulation side effect?

Post by snibgo »

For me, IM v6.8.3 on Windows 7, it converts with no problem.
snibgo's IM pages: im.snibgo.com
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Gif manipulation side effect?

Post by glennrp »

redroom wrote: Should I set some additional parameters to avoid that ?
Thanks for ur help.
What are you using to view the image? The bug may be in the
viewer. The image has only 3 colors and has bit_depth=2 in both
the input GIF and output PNG. You can force the PNG to have
bit_depth=8 by running

Code: Select all

convert mn.gif png8:mn.png
redroom
Posts: 3
Joined: 2013-03-22T04:07:59-07:00
Authentication code: 6789

Re: Gif manipulation side effect?

Post by redroom »

thanks, I'm viewing it with FF and paint.net
Here is what I got as result :
Image
and I'm using 6.8.3-10, more or less like snibgo, it seems.
redroom
Posts: 3
Joined: 2013-03-22T04:07:59-07:00
Authentication code: 6789

Re: Gif manipulation side effect?

Post by redroom »

Hello,
I tried it today with a fresh install : X64 version on Win 7... same result...
Or there is a bug in the current version of IM, or there is something special about that image ?
the png8: flag doesn't change result, any ideas ?
thanks.
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Gif manipulation side effect?

Post by glennrp »

redroom wrote:thanks, I'm viewing it with FF and paint.net
... and I'm using 6.8.3-10, more or less like snibgo, it seems.
That looks like an interlaced image being rendered incorrectly. Your source image mn.gif
is in fact GIF interlaced, according to "identify -verbose". When I use IM-6.8.3-10 (on Linux) to
convert mn.gif to mn.png, the resulting PNG is not interlaced.
jhuckaby
Posts: 15
Joined: 2013-03-29T09:40:03-07:00
Authentication code: 6789

Re: Gif manipulation side effect?

Post by jhuckaby »

I can confirm this is happening for me as well, using any number of different interlaced GIF89a images. It only seems to happen if the GIF is interlaced. I am using ImageMagick 6.8.3-10 (Q8) on CentOS 6.2 (64-bit).

To reproduce, download one of the following interlaced GIF 89a images:

https://dl.dropbox.com/u/4585115/89a-interlaced.gif
https://dl.dropbox.com/u/4585115/interlaced.gif

And simply convert the format:

convert 89a-interlaced.gif test.png
convert 89a-interlaced.gif test.jpg
convert interlaced.gif test2.png
convert interlaced.gif test2.jpg

And view the resulting image in any viewer app. I have samples of the outputs here:

https://dl.dropbox.com/u/4585115/im-test.jpg
https://dl.dropbox.com/u/4585115/im-test.png
https://dl.dropbox.com/u/4585115/im-test2.jpg
https://dl.dropbox.com/u/4585115/im-test2.png

As you can see, the images do not look correct. Note that these tests work perfectly on previous versions of ImageMagick (I have tested on 6.3.8 and 6.2.4). I have being using interlaced GIF89a images for years, and have been using "interlaced.gif" as a test image without issue until this version of ImageMagick.

One final note. It seems that the problem is in the loading of the GIF, not the conversion. If I load an interlaced GIF89a and simply composite it on top of a blank canvas, the final image still shows the problem on IM 6.8.3-10.

- Joe
jhuckaby
Posts: 15
Joined: 2013-03-29T09:40:03-07:00
Authentication code: 6789

Re: Gif manipulation side effect?

Post by jhuckaby »

Addendum: I just tried with the latest build (ImageMagick 6.8.4-4 as of March 29, 2013) and the bug still exists.
jhuckaby
Posts: 15
Joined: 2013-03-29T09:40:03-07:00
Authentication code: 6789

Re: Gif manipulation side effect?

Post by jhuckaby »

Addendum 2: I cannot reproduce the bug using ImageMagick 6.8.2-10. So it was introduced sometime between 6.8.2-10 (Feb 12) and 6.8.3-10 (March 18).
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Gif manipulation side effect?

Post by fmw42 »

I can confirm your result using IM 6.8.4.4 Q16 Mac OSX Snow Leopard.

Perhaps glennrp (the png expert) can shed more light.
Last edited by fmw42 on 2013-03-30T17:07:23-07:00, edited 1 time in total.
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Gif manipulation side effect?

Post by glennrp »

The bug (in the gif decoder) has been fixed by "magick" as of IM-6.8.4-5.
jhuckaby
Posts: 15
Joined: 2013-03-29T09:40:03-07:00
Authentication code: 6789

Re: Gif manipulation side effect?

Post by jhuckaby »

Confirmed fixed in 6.8.4-5! Thanks so much!
Post Reply