Page 1 of 1

Mogrify on corrupt images crashing server (doesnt timeout)

Posted: 2011-06-22T16:04:50-07:00
by mikemeadeuk
Hi Guys,

I have a little problem. I am using mogrify to trim whitespace from images within a directory in a recursive manner using the unix find command.

However, i have a few corrupt images and mogrify plods along nicely until it hits one of these corrupt images. Then it just hangs and eventually my server loads hits about 80 and dies.

I have tried setting the timeout in both policy.xml and via the command line but it doesnt seem to work.

Is there anyway I can

a: avoid corrupt images
b: avoid images below 10x10 pixels (the corrupt images seem to be 0x0 pixels)
c: make the timeout work so that it skips it if it doesnt complete the task

Hopefully someone can point me in the rigth direction because im stuck for ideas!

thanks in advance guys!

Mike

oh, and the command I am using is:

Code: Select all

find /directory/ -name "*.jpg" -exec mogrify -trim -fuzz 1% {} \;
and also tried:

Code: Select all

find /directory/ -name "*.jpg" -exec mogrify -limit time 20 -trim -fuzz 1% {} \;

Re: Mogrify on corrupt images crashing server (doesnt timeou

Posted: 2011-06-22T17:19:39-07:00
by fmw42
can't you just use ls -al to filter out any file that has zero filesize for the images that are 0x0 in dimensions?

Re: Mogrify on corrupt images crashing server (doesnt timeou

Posted: 2011-06-23T02:13:35-07:00
by mikemeadeuk
Hi fmw42,

Yeah I thought about that, but it turns out that although the dimensions are 0x0, the file size is still > 100k. I think the only reason the dimensions are 0x0 is because the operating system cant actually read/view it?

Any other ideas?

Cheers

Mike

Re: Mogrify on corrupt images crashing server (doesnt timeou

Posted: 2011-06-23T10:04:51-07:00
by fmw42
what happens when you do

convert corruptimage.jpg image.jpg

does it crash, abort, hang?

Re: Mogrify on corrupt images crashing server (doesnt timeou

Posted: 2011-06-23T10:45:27-07:00
by mikemeadeuk
Hi,

it completely crashed my system and I have to reboot via KVM.

If I add a "-limit thread 1" to the command i can see it takes up 100% of one of my cpus and stays there forever.

Re: Mogrify on corrupt images crashing server (doesnt timeou

Posted: 2011-06-23T12:54:00-07:00
by fmw42
what happens if you do

convert image -regard-warnings newimage || echo "bad image"

Re: Mogrify on corrupt images crashing server (doesnt timeou

Posted: 2011-06-23T13:14:05-07:00
by mikemeadeuk
hi,

its just doing the same thing, sitting at 100% cpu and not doing anything. ?

Re: Mogrify on corrupt images crashing server (doesnt timeou

Posted: 2011-06-23T13:15:54-07:00
by fmw42
What do you get from:

convert image -ping -format "%wx%h" info:

if 0x0, then you you can trap on that.

Re: Mogrify on corrupt images crashing server (doesnt timeou

Posted: 2011-06-23T13:31:07-07:00
by mikemeadeuk
hi, the same thing again. 100% cpu and no result.

Re: Mogrify on corrupt images crashing server (doesnt timeou

Posted: 2011-06-23T13:50:20-07:00
by fmw42
sorry then, I am out of ideas. hopefully one of the IM developers may have more insight.

Re: Mogrify on corrupt images crashing server (doesnt timeou

Posted: 2011-06-23T14:21:52-07:00
by mikemeadeuk
ok well thanks for your help anyway. :)

Re: Mogrify on corrupt images crashing server (doesnt timeou

Posted: 2011-06-23T15:22:09-07:00
by fmw42
you probably will need to post a link to one of your bad images, so that the IM developers have some way to duplicate your issue. you should also identify what version of IM you are using and on which platform.