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.
canavan
Posts: 23 Joined: 2013-02-18T10:12:03-07:00
Authentication code: 6789
Post
by canavan » 2016-08-05T05:36:24-07:00
convert with -resize / -scale aborts with a NegativeOrZeroImageSize error if an image is reduced in size and one dimension is rounded down to zero. I'm using ImageMagick 7.0.2-6 on Ubuntu x64 16.04.
Examples:
Code: Select all
$ convert -size 1000x1 xc:red -resize 49% /tmp/r.png
convert: NegativeOrZeroImageSize `red' @ error/resize.c/ResizeImage/2855.
$ convert -size 1000x1 xc:red -scale 49% /tmp/r.png
convert: NegativeOrZeroImageSize `red' @ error/resize.c/ScaleImage/3225.
$ convert -size 1000x10 xc:red -scale 4% /tmp/r.png
convert: NegativeOrZeroImageSize `red' @ error/resize.c/ScaleImage/3225.
$ convert -size 10x1000 xc:red -scale 4% /tmp/r.png
convert: NegativeOrZeroImageSize `red' @ error/resize.c/ScaleImage/3225.
$ convert -size 10x1000 xc:red -resize 10@ /tmp/r.png
convert: NegativeOrZeroImageSize `red' @ error/resize.c/ResizeImage/2855.
snibgo
Posts: 12159 Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK
Post
by snibgo » 2016-08-05T05:57:59-07:00
Yes, that's what happens. IM won't create images with zero or negative dimensions. This isn't a bug, but by design.
What would you prefer it did instead?
canavan
Posts: 23 Joined: 2013-02-18T10:12:03-07:00
Authentication code: 6789
Post
by canavan » 2016-08-08T03:55:43-07:00
I'd prefer it to round to 1 instead of 0. Throwing an exception is still OK if the user explicitly specifies a width or height of 0.
This behaviour was considered a bug in the past, for example in
viewtopic.php?t=9082