Page 1 of 1

[RESOLVED] Convert locking up with specific image.

Posted: 2011-11-22T14:48:51-07:00
by mmazing
Hello,

I manage a website where people can upload photos for various reasons, and came across a particular file that was causing convert to lock up and create enormous temporary files.

The command was :

/usr/local/bin/convert FILENAME.JPG -resample 72x72 -resize 0.66% /data/www/temp_photos/FILENAME_2.JPG

The image was :

http://removed.jpg

The debug output was :

http://dl.dropbox.com/u/10460707/convert-debug2.txt

The debug would have continued on for quite a while, it looks like it is processing each individual pixel when I just let the debug output go for a while.

Using identify on the original image (this command) :

identify -format "%[colorspace] %[xresolution] %[width] %[height]" FILENAME.JPG

Yields - RGB 2 3937 2625

Thanks for any help! This one has me stumped.
- Chase

Re: Convert locking up with specific image.

Posted: 2011-11-22T15:39:52-07:00
by fmw42
your input image density (resolution) = 2, so perhaps -resample is having trouble or making a huge image before you resize by 0.66% which is very small.

Why don't you just resize the input image to your desired WxH and then set the density to 72.

convert yourimage.jpg -resize WxH -density 72 resultimage.jpg

Re: Convert locking up with specific image.

Posted: 2011-11-22T15:42:25-07:00
by mmazing
It seems to be a problem with the resampling, for some reason the original image has a DPI of "2/1" in the EXIF data.

The problem goes away if I remove the -resample 72x72 option.

Re: Convert locking up with specific image.

Posted: 2011-11-22T15:43:58-07:00
by mmazing
fmw42 wrote:your input image density (resolution) = 2, so perhaps -resample is having trouble or making a huge image before you resize by 0.66% which is very small.

Why don't you just resize the input image to your desired WxH and then set the density to 72.

convert yourimage.jpg -resize WxH -density 72 resultimage.jpg
Thanks, I'll try this.

Edit : I'm pretty sure this will fix it, thanks again.