Page 1 of 1

Possible bug -layers optimize

Posted: 2017-09-15T20:09:42-07:00
by fmw42
Using both IM 6.9.9.13 Q16 and IM 7.0.7.2 Q16 Mac OSX Sierra, the following command works fine. But when I add -layers optimize, I get a corrupt gif animation.

Input Images: Note the input.gif is coalesced to 1080x1920 and has 77 frames.

http://www.fmwconcepts.com/misc_tests/l ... /image.png
http://www.fmwconcepts.com/misc_tests/l ... /input.gif


Works fine:

Code: Select all

convert image.png null: \( input.gif -coalesce \) -gravity Center -layers composite des.gif
Does not work:

Code: Select all

convert image.png null: \( input.gif -coalesce \) -gravity Center -layers composite -layers optimize des.gif
Does -layers optimize need more memory such that perhaps I am running out?

Re: Possible bug -layers optimize

Posted: 2017-09-15T22:28:50-07:00
by snibgo
On my 12 GB laptop, Windows 8.1, IM v6.9.5-3, your second command took 1.3 GB memory, plus 26 files each 26 MB in %TEMP%. It ran for a few minutes, and I killed it.

I made MPC versions of your files, and ran your first command:

Code: Select all

%IM%convert image.png fmwimage.mpc
%IM%convert input.gif -coalesce fmwinput.mpc

%IM%convert fmwimage.mpc null: ( fmwinput.mpc ) -gravity Center -layers composite  des.gif
convert.exe: memory allocation failed `des.gif' @ error/quantize.c/QuantizeImage/2643.
convert.exe: memory allocation failed `des.gif' @ error/gif.c/WriteGIFImage/1643.
Oddly, it only took 600 MB before failing. Perhaps it then made a huge request for memory. I can't see the problem in the debug output.

Re: Possible bug -layers optimize

Posted: 2017-09-16T06:01:33-07:00
by magick
Try this command, and be patient. Its pushing pixels to disk so its quite slow:

Code: Select all

convert -define registry:temporary-path=./ -limit memory 16mb image.png null: \( input.gif -coalesce \) -gravity Center -layers composite -layers optimize des.gif

Re: Possible bug -layers optimize

Posted: 2017-09-16T10:25:12-07:00
by fmw42
Why did my second command run to completion without any error message about "memory allocation failed" but produce a corrupt file.

If it had run out of memory, I would have expected it to have produced some kind of error message!


I tried:

Code: Select all

convert -limit area 0 -debug all image.png null: \( input.gif -coalesce \) -gravity Center -layers composite -layers optimize des2.gif
It ran for nearly 2 minutes and then ended properly with no error message, but still produced a corrupt animated gif

Here is the des2.gif and a debug.txt file with the debug output.

http://www.fmwconcepts.com/misc_tests/l ... g/des2.gif
http://www.fmwconcepts.com/misc_tests/l ... /debug.txt

I have also tried -limit thread 1 and disabling OpenMP in another compile, but they also produce a corrupt gif with the above command.

Re: Possible bug -layers optimize

Posted: 2017-09-16T15:35:13-07:00
by fmw42
It appears to be a Mac Preview issue. I can open and increment the frame fine in GraphicConvert for the Mac.

Animate also opens the image, but I cannot see enough of it using Xquartz to know if it is animating.

Safari won’t open it. But Firefox plays it just fine.

If I add -resize 50% to both images, it works fine in Mac Preview