[SOLVED] Bug with convert

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.
Post Reply
grigory
Posts: 15
Joined: 2015-05-24T05:48:35-07:00
Authentication code: 6789

[SOLVED] Bug with convert

Post by grigory »

Hey guys,

I have a problem trying to split big animated GIF into frames (17Mb).
I use the following command:
/usr/local/bin/convert -coalesce /gifs/test.gif /gifs/result/%d.gif

This GIF has 150 frames and lasts 5 seconds with FPS=10 (I made it from video).
However, most of the time in a result folder I get from 45 to 65 files.
For some reason, last frame has only 10 bytes. Sometimes I get all 150 frames but it happens very rare.
Convert usually stops without any warnings and errors in 22-28 seconds.

Here is the animation -- http://countriesguide.com/test.gif

Any ideas?

P.S.: ImageMagick 6.9.1-3
Last edited by grigory on 2016-01-16T11:33:39-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Bug with convert

Post by fmw42 »

try

Code: Select all

/usr/local/bin/convert /gifs/test.gif -coalesce +adjoin /gifs/result/test_%03d.gif
grigory
Posts: 15
Joined: 2015-05-24T05:48:35-07:00
Authentication code: 6789

Re: Bug with convert

Post by grigory »

Tried it twice -- got 31 and 41 frames while it has 150 frames. The last one had 10 bytes.
Also tried it on my second server (2xXeon, 24Gb RAM, ImageMagick 6.8.6-10), got 130 frames without adjoin and 108 with adjoin, last one also had 10 bytes. BTW, adjoin option makes the process much slower. My first server has Dual Core + 8Gb RAM.

Bug?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Bug with convert

Post by snibgo »

No problem on my computer.

How much free memory do you have? Q16 takes 8 bytes/pixel. Coalesce might double this, so that would be 553 MB. That isn't much these days, but it's worth checking.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Bug with convert

Post by fmw42 »

Perhaps the tmp directory is getting too full
grigory
Posts: 15
Joined: 2015-05-24T05:48:35-07:00
Authentication code: 6789

Re: Bug with convert

Post by grigory »

No problem on my computer.
Do you use linux? Well, sometimes I get 150 frames. This happens in 4/10. Also I make test on a production servers, not an idle PC.
snibgo wrote:How much free memory do you have? Q16 takes 8 bytes/pixel. Coalesce might double this, so that would be 553 MB. That isn't much these days, but it's worth checking.
My servers have 8 and 24 GBytes RAM respectively. Or you meant some sort of memory per each IM proccess? If so, how can I check it?
Perhaps the tmp directory is getting too full
/tmp is mounted on /dev/shm which has 4 GBytes of space.

Please keep in mind guys, that I use 2 version of IM on 2 different servers with different hardware configuration.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Bug with convert

Post by fmw42 »

OK. Let me understand. Sorry if you have to repeat. Do both systems have trouble? If not, which one and what version of Imagemagick.

I am on Imagemagick 6.9.3.0 Q16 Mac OSX (Mac Mini with 4GB RAM) and the following works fine and creates all your frames

Code: Select all

cd test1
convert test.gif -coalesce ../test2/test_%03d.gif
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Bug with convert

Post by snibgo »

I'm on IM v6.9.2-5, Windows 8.1, 12 GB RAM. Servers sometimes limit memory to 1 GB per process. If you have >2 GB available, that's not the problem.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Bug with convert

Post by fmw42 »

check your Imagemagick policy.xml file to see if anything else has been limited in IM otherwise, as snibgo says, check your server for other limitations.
grigory
Posts: 15
Joined: 2015-05-24T05:48:35-07:00
Authentication code: 6789

Re: Bug with convert

Post by grigory »

fmw42 wrote:OK. Let me understand. Sorry if you have to repeat. Do both systems have trouble? If not, which one and what version of Imagemagick.

I am on Imagemagick 6.9.3.0 Q16 Mac OSX (Mac Mini with 4GB RAM) and the following works fine and creates all your frames

Code: Select all

cd test1
convert test.gif -coalesce ../test2/test_%03d.gif
Yes, both servers have trouble (IM 6.8.6-10 and IM 6.9.1-3). That's why I opened this topic.
check your Imagemagick policy.xml file to see if anything else has been limited in IM otherwise, as snibgo says, check your server for other limitations.
I don't have anything policy.xml (all options are commented out). And what kind of check shall I make? As snibgo said, memory is not a problem in my case.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Bug with convert

Post by magick »

Perhaps you are running out of temporary space, typically /tmp. Set the MAGICK_TMP environment variable to a path that has copious amount of free space:
  • export MAGICK_TMP=/data/tmp
    convert -limit memory 2MiB -limit map 4MiB test.gif -coalesce ../test2/test_%03d.gif
grigory
Posts: 15
Joined: 2015-05-24T05:48:35-07:00
Authentication code: 6789

Re: Bug with convert

Post by grigory »

Oh guys, promise me you won't laugh :-D I found out what was the problem!
A couple of years ago I made a simple tool which kills any "convert" process after 40 seconds because of old IM bug when IM hanged my server.
So this tiny tool killed any convert process before it could prepare all the 150 frames of my .gif file :-D :-D :-D
And I had it running in memory 24/7 on both servers :-D
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: [SOLVED] Bug with convert

Post by fmw42 »

Glad to hear it was that simple. Sometimes the simplest issue are the hardest to find.
grigory
Posts: 15
Joined: 2015-05-24T05:48:35-07:00
Authentication code: 6789

Re: [SOLVED] Bug with convert

Post by grigory »

Yeah, I spent many hours trying to find a bug in my code + PHP/Apache configs + IM :-D
Post Reply