Resize-fill exceeds max. supported dimensions

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
borzik
Posts: 2
Joined: 2019-06-10T02:50:37-07:00
Authentication code: 1152

Resize-fill exceeds max. supported dimensions

Post by borzik » 2019-06-10T03:01:53-07:00

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.

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

Re: Resize-fill exceeds max. supported dimensions

Post by snibgo » 2019-06-10T03:25:16-07:00

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
snibgo's IM pages: im.snibgo.com

borzik
Posts: 2
Joined: 2019-06-10T02:50:37-07:00
Authentication code: 1152

Re: Resize-fill exceeds max. supported dimensions

Post by borzik » 2019-06-10T05:11:01-07:00

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.

Post Reply