Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
vlodagon
Posts: 5 Joined: 2013-07-24T13:53:30-07:00
Authentication code: 6789
Post
by vlodagon » 2013-07-24T14:25:39-07:00
We have 2 animated GIFs:
https://docs.google.com/file/d/0B9AgH7L ... sp=sharing
https://docs.google.com/file/d/0B9AgH7L ... sp=sharing
This GIFs are correct but can't be opened in ImageMagic. It throws the following exception:
Code: Select all
$ ./convert /tmp/1.gif -debug All -resize 500x200 /tmp/res.gif
2013-07-25T01:28:52+04:00 0:00.000 0.000u 6.8.5 Configure lt-convert[12697]: utility.c/ExpandFilenames/941/Configure
Command line: /tmp/ImageMagick-6.8.6/utilities/.libs/lt-convert {/tmp/1.gif} {-debug} {All} {-resize} {500x200} {/tmp/res.gif}
2013-07-25T01:28:52+04:00 0:00.010 0.000u 6.8.5 Policy lt-convert[12697]: policy.c/IsRightsAuthorized/485/Policy
Domain: Path; rights=Read; pattern="/tmp/1.gif" ...
2013-07-25T01:28:52+04:00 0:00.010 0.000u 6.8.5 Blob lt-convert[12697]: blob.c/OpenBlob/2536/Blob
read 3 magic header bytes
2013-07-25T01:28:52+04:00 0:00.010 0.000u 6.8.5 Cache lt-convert[12697]: cache.c/DestroyPixelCache/933/Cache
destroy
2013-07-25T01:28:52+04:00 0:00.010 0.000u 6.8.5 Configure lt-convert[12697]: configure.c/GetConfigureOptions/589/Configure
Searching for configure file: "/usr/local/share/ImageMagick-6/magic.xml"
2013-07-25T01:28:52+04:00 0:00.010 0.000u 6.8.5 Configure lt-convert[12697]: configure.c/GetConfigureOptions/589/Configure
Searching for configure file: "/usr/local/lib/ImageMagick-6.8.5//config-Q16/magic.xml"
2013-07-25T01:28:52+04:00 0:00.010 0.000u 6.8.5 Configure lt-convert[12697]: configure.c/GetConfigureOptions/589/Configure
Searching for configure file: "/usr/local/etc/ImageMagick-6/magic.xml"
2013-07-25T01:28:52+04:00 0:00.010 0.000u 6.8.5 Configure lt-convert[12697]: configure.c/GetConfigureOptions/589/Configure
Searching for configure file: "/usr/local/share/doc/ImageMagick-6/magic.xml"
2013-07-25T01:28:52+04:00 0:00.010 0.000u 6.8.5 Configure lt-convert[12697]: configure.c/GetConfigureOptions/589/Configure
Searching for configure file: "/tmp/.magick/magic.xml"
2013-07-25T01:28:52+04:00 0:00.010 0.000u 6.8.5 Exception lt-convert[12697]: configure.c/GetConfigureOptions/616/Exception
UnableToOpenConfigureFile `magic.xml'
2013-07-25T01:28:52+04:00 0:00.010 0.000u 6.8.5 Policy lt-convert[12697]: policy.c/IsRightsAuthorized/485/Policy
Domain: Coder; rights=Read; pattern="GIF" ...
2013-07-25T01:28:52+04:00 0:00.010 0.000u 6.8.5 Policy lt-convert[12697]: policy.c/IsRightsAuthorized/485/Policy
Domain: Path; rights=Read; pattern="/tmp/1.gif" ...
2013-07-25T01:28:52+04:00 0:00.010 0.000u 6.8.5 Blob lt-convert[12697]: blob.c/OpenBlob/2536/Blob
read 3 magic header bytes
2013-07-25T01:28:52+04:00 0:00.010 0.000u 6.8.5 Resource lt-convert[12697]: resource.c/AcquireMagickResource/278/Resource
Area: 11.2KB/11.2KB/8.0037GB
2013-07-25T01:28:52+04:00 0:00.010 0.000u 6.8.5 Resource lt-convert[12697]: resource.c/AcquireMagickResource/278/Resource
Memory: 11.2KB/11KiB/3.727GiB
2013-07-25T01:28:52+04:00 0:00.010 0.000u 6.8.5 Cache lt-convert[12697]: cache.c/OpenPixelCache/3548/Cache
open /tmp/1.gif[0] (Heap Memory, 45x25 11KiB)
2013-07-25T01:28:52+04:00 0:00.010 0.000u 6.8.5 Resource lt-convert[12697]: resource.c/AcquireMagickResource/278/Resource
Area: 280B/280B/8.0037GB
2013-07-25T01:28:52+04:00 0:00.010 0.000u 6.8.5 Resource lt-convert[12697]: resource.c/AcquireMagickResource/278/Resource
Memory: 280B/11.3KiB/3.727GiB
2013-07-25T01:28:52+04:00 0:00.010 0.000u 6.8.5 Cache lt-convert[12697]: cache.c/OpenPixelCache/3548/Cache
open /tmp/1.gif[1] (Heap Memory, 7x4 280B)
2013-07-25T01:28:52+04:00 0:00.010 0.000u 6.8.5 Exception lt-convert[12697]: cache.c/QueueAuthenticPixelCacheNexus/3927/Exception
PixelsAreNotAuthentic `/tmp/1.gif'
2013-07-25T01:28:52+04:00 0:00.010 0.000u 6.8.5 Exception lt-convert[12697]: gif.c/DecodeImage/508/Exception
CorruptImage `/tmp/1.gif'
2013-07-25T01:28:52+04:00 0:00.010 0.000u 6.8.5 Exception lt-convert[12697]: gif.c/ReadGIFImage/1365/Exception
CorruptImage `/tmp/1.gif'
2013-07-25T01:28:52+04:00 0:00.010 0.000u 6.8.5 Cache lt-convert[12697]: cache.c/DestroyPixelCache/933/Cache
destroy /tmp/1.gif[1]
2013-07-25T01:28:52+04:00 0:00.010 0.000u 6.8.5 Resource lt-convert[12697]: resource.c/RelinquishMagickResource/851/Resource
Memory: 280B/11KiB/3.727GiB
2013-07-25T01:28:52+04:00 0:00.010 0.000u 6.8.5 Cache lt-convert[12697]: cache.c/DestroyPixelCache/933/Cache
destroy /tmp/1.gif[0]
2013-07-25T01:28:52+04:00 0:00.010 0.000u 6.8.5 Resource lt-convert[12697]: resource.c/RelinquishMagickResource/851/Resource
Memory: 11.2KB/0B/3.727GiB
2013-07-25T01:28:52+04:00 0:00.010 0.000u 6.8.5 Exception lt-convert[12697]: convert.c/ConvertImageCommand/3106/Exception
NoImagesDefined `/tmp/res.gif'
lt-convert: CorruptImage `/tmp/1.gif' @ error/gif.c/ReadGIFImage/1365.
lt-convert: NoImagesDefined `/tmp/res.gif' @ error/convert.c/ConvertImageCommand/3106.
fmw42
Posts: 25562 Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA
Post
by fmw42 » 2013-07-24T14:44:33-07:00
IM can get the statistics for me on IM 6.8.6.6 Q16 Mac OSX
identify 1.gif
Code: Select all
1.gif[0] GIF 45x25 45x25+0+0 8-bit sRGB 128c 6.33KB 0.000u 0:00.009
1.gif[1] GIF 7x4 45x25+32+11 8-bit sRGB 128c 6.33KB 0.000u 0:00.009
1.gif[2] GIF 7x4 45x25+32+11 8-bit sRGB 128c 6.33KB 0.000u 0:00.009
1.gif[3] GIF 3x2 45x25+32+13 8-bit sRGB 128c 6.33KB 0.000u 0:00.009
1.gif[4] GIF 20x23 45x25+25+2 8-bit sRGB 128c 6.33KB 0.000u 0:00.009
1.gif[5] GIF 21x23 45x25+22+2 8-bit sRGB 128c 6.33KB 0.000u 0:00.000
1.gif[6] GIF 1x1 45x25+0+0 8-bit sRGB 128c 6.33KB 0.000u 0:00.000
1.gif[7] GIF 13x13 45x25+22+9 8-bit sRGB 128c 6.33KB 0.000u 0:00.000
1.gif[8] GIF 27x22 45x25+13+3 8-bit sRGB 128c 6.33KB 0.000u 0:00.000
1.gif[9] GIF 27x22 45x25+11+3 8-bit sRGB 128c 6.33KB 0.000u 0:00.000
1.gif[10] GIF 12x13 45x25+21+9 8-bit sRGB 128c 6.33KB 0.000u 0:00.000
1.gif[11] GIF 7x11 45x25+25+11 8-bit sRGB 128c 6.33KB 0.000u 0:00.000
1.gif[12] GIF 19x11 45x25+13+11 8-bit sRGB 128c 6.33KB 0.000u 0:00.000
1.gif[13] GIF 19x5 45x25+13+17 8-bit sRGB 128c 6.33KB 0.000u 0:00.000
1.gif[14] GIF 21x7 45x25+11+17 8-bit sRGB 128c 6.33KB 0.000u 0:00.000
1.gif[15] GIF 21x6 45x25+11+16 8-bit sRGB 128c 6.33KB 0.000u 0:00.000
1.gif[16] GIF 20x7 45x25+11+16 8-bit sRGB 128c 6.33KB 0.000u 0:00.000
1.gif[17] GIF 25x14 45x25+11+10 8-bit sRGB 128c 6.33KB 0.000u 0:00.000
1.gif[18] GIF 27x7 45x25+13+18 8-bit sRGB 128c 6.33KB 0.000u 0:00.000
1.gif[19] GIF 30x11 45x25+14+14 8-bit sRGB 128c 6.33KB 0.000u 0:00.000
1.gif[20] GIF 32x12 45x25+12+11 8-bit sRGB 128c 6.33KB 0.000u 0:00.000
1.gif[21] GIF 33x13 45x25+11+11 8-bit sRGB 128c 6.33KB 0.000u 0:00.000
1.gif[22] GIF 33x13 45x25+11+11 8-bit sRGB 128c 6.33KB 0.000u 0:00.000
1.gif[23] GIF 10x14 45x25+34+11 8-bit sRGB 128c 6.33KB 0.000u 0:00.000
1.gif[24] GIF 6x7 45x25+34+18 8-bit sRGB 128c 6.33KB 0.000u 0:00.000
1.gif[25] GIF 18x9 45x25+18+15 8-bit sRGB 128c 6.33KB 0.000u 0:00.000
1.gif[26] GIF 9x10 45x25+14+14 8-bit sRGB 128c 6.33KB 0.000u 0:00.000
1.gif[27] GIF 22x9 45x25+11+14 8-bit sRGB 128c 6.33KB 0.000u 0:00.000
1.gif[28] GIF 20x10 45x25+11+14 8-bit sRGB 128c 6.33KB 0.000u 0:00.000
1.gif[29] GIF 19x14 45x25+12+11 8-bit sRGB 128c 6.33KB 0.000u 0:00.000
1.gif[30] GIF 22x14 45x25+11+11 8-bit sRGB 128c 6.33KB 0.000u 0:00.000
1.gif[31] GIF 21x15 45x25+13+10 8-bit sRGB 128c 6.33KB 0.000u 0:00.000
1.gif[32] GIF 10x14 45x25+13+9 8-bit sRGB 128c 6.33KB 0.000u 0:00.000
1.gif[33] GIF 9x15 45x25+14+9 8-bit sRGB 128c 6.33KB 0.000u 0:00.000
1.gif[34] GIF 5x7 45x25+18+17 8-bit sRGB 128c 6.33KB 0.000u 0:00.000
1.gif[35] GIF 7x4 45x25+25+11 8-bit sRGB 128c 6.33KB 0.000u 0:00.000
1.gif[36] GIF 7x4 45x25+25+11 8-bit sRGB 128c 6.33KB 0.000u 0:00.000
1.gif[37] GIF 21x24 45x25+20+1 8-bit sRGB 128c 6.33KB 0.000u 0:00.000
c-98-234-221-122:desktop fred$
But I get the same error message when trying to resize, even using -coalesce.
convert 1.gif -coalesce -resize 500x200 2.gif
convert: corrupt image `1.gif' @ error/gif.c/ReadGIFImage/1365.
Or even just trying to copy it
convert 1.gif 2.gif
convert: corrupt image `1.gif' @ error/gif.c/ReadGIFImage/1365.
identify -verbose 1.gif[0] works fine, but identify -verbose 1.gif[1] fails with the same error message
vlodagon
Posts: 5 Joined: 2013-07-24T13:53:30-07:00
Authentication code: 6789
Post
by vlodagon » 2013-07-29T10:18:09-07:00
looks like bug in following code in DecodeImage() and EncodeImage() functions in coders/gif.c
Code: Select all
switch (pass)
{
case 0:
default:
{
offset+=8;
if (offset >= (ssize_t) image->rows)
{
pass++;
offset=4;
}
break;
so decode will fail with all interlaced gifs containing frames with height less then 5
magick
Site Admin
Posts: 11064 Joined: 2003-05-31T11:32:55-07:00
Post
by magick » 2013-07-31T17:23:57-07:00
We can reproduce the problem you posted and have a patch in ImageMagick 6.8.6-8 Beta available by sometime tomorrow. Thanks.
vlodagon
Posts: 5 Joined: 2013-07-24T13:53:30-07:00
Authentication code: 6789
Post
by vlodagon » 2013-08-14T04:09:47-07:00
thanks for the fix, but now these images are incorrect after resize
Code: Select all
./convert 1.gif -resize 100x100 res.gif
dlemstra
Posts: 1570 Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:
Post
by dlemstra » 2013-08-17T15:26:40-07:00
You should first 'coalesce' the image.
./convert 1.gif -coalesce -resize 100x100 res.gif
And if you also add '-layers optimize' your file size will be reduced.
./convert 1.gif -coalesce -resize 100x100 -layers optimize res.gif
The result is not that great. Might be an rounding issue in the coalesce operation.
vlodagon
Posts: 5 Joined: 2013-07-24T13:53:30-07:00
Authentication code: 6789
Post
by vlodagon » 2013-08-19T02:59:07-07:00
Thanks for the support. Result is not great not because rounding issue, but because fix is incorrect. If height of interlaced image less then 8px, missing rows (pass) should be skipped instead of disabling interlacing at all.
vlodagon
Posts: 5 Joined: 2013-07-24T13:53:30-07:00
Authentication code: 6789
Post
by vlodagon » 2013-09-16T08:11:51-07:00
correct path for 6.8.6-9 to fix this problem look so:
Code: Select all
--- a/coders/gif.c
+++ b/coders/gif.c
@@ -397,9 +397,6 @@ static MagickBooleanType DecodeImage(Image *image,const ssize_t opacity)
int
c;
- InterlaceType
- interlace;
-
LZWInfo
*lzw_info;
@@ -428,9 +425,6 @@ static MagickBooleanType DecodeImage(Image *image,const ssize_t opacity)
ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
image->filename);
exception=(&image->exception);
- interlace=image->interlace;
- if (image->rows < 8)
- interlace=NoInterlace;
pass=0;
offset=0;
for (y=0; y < (ssize_t) image->rows; y++)
@@ -465,40 +459,26 @@ static MagickBooleanType DecodeImage(Image *image,const ssize_t opacity)
break;
if (x < (ssize_t) image->columns)
break;
- if (interlace == NoInterlace)
+ if (image->interlace == NoInterlace)
offset++;
else
+ {
switch (pass)
{
case 0:
default:
{
offset+=8;
- if (offset >= (ssize_t) image->rows)
- {
- pass++;
- offset=4;
- }
break;
}
case 1:
{
offset+=8;
- if (offset >= (ssize_t) image->rows)
- {
- pass++;
- offset=2;
- }
break;
}
case 2:
{
offset+=4;
- if (offset >= (ssize_t) image->rows)
- {
- pass++;
- offset=1;
- }
break;
}
case 3:
@@ -507,6 +487,19 @@ static MagickBooleanType DecodeImage(Image *image,const ssize_t opacity)
break;
}
}
+ if (pass == 0 && offset >= (ssize_t) image->rows) {
+ pass++;
+ offset=4;
+ }
+ if (pass == 1 && offset >= (ssize_t) image->rows) {
+ pass++;
+ offset=2;
+ }
+ if (pass == 2 && offset >= (ssize_t) image->rows) {
+ pass++;
+ offset=1;
+ }
+ }
}
lzw_info=RelinquishLZWInfo(lzw_info);
if (y < (ssize_t) image->rows)