Page 1 of 1

Resize-fill exceeds max. supported dimensions

Posted: 2019-06-10T03:01:53-07:00
by borzik
I have an image with 1800x1 dimensions.
When I call

Code: Select all

convert ~/img.jpg -resize "300x200^" ~/processed.img
it returns this message:

Code: Select all

Maximum supported image dimension is 65500 pixels `/home/user/processed.img' @ error/jpeg.c/JPEGErrorHandler/340
At the same time it uses 1.84GB of RAM for a couple seconds.
I guess that it attempts to make it wider by multiplying both height and width by 200 (desired width), and ends up with 360000x200 image, which is obviously too large. Probably this is a bug because resulting image is expected to fill the desired area, and it doesn't have to produce such a large image during this process.

Re: Resize-fill exceeds max. supported dimensions

Posted: 2019-06-10T03:25:16-07:00
by snibgo
What version of IM, on what platform?

"-resize" generally keeps the same aspect ratio, so the result width will be 1800 times the height.

What dimensions do you want in the result? If 300x200 then use "!". See http://www.imagemagick.org/script/comma ... p#geometry

Code: Select all

convert ~/img.jpg -resize "300x200!" ~/processed.img

Re: Resize-fill exceeds max. supported dimensions

Posted: 2019-06-10T05:11:01-07:00
by borzik
Actually your point is valid and I'm sorry I didn't understand docs correctly, it works as expected so this thread can be closed.

I wanted image (smaller/larger) to fill 300x200 while maintaining aspect ratio and avoiding crop but cropping when necessary to keep height less than 600px (in this case width will have to remain 300), but I think I should re-read docs myself and handle this edge case somehow, this is out of this thread's scope anyway.