Page 1 of 1

convert to gray always generates square images

Posted: 2016-05-03T12:59:50-07:00
by elafargue
I have just run into a weird bug on Imagemagick: I need to convert images to raw greyscale, and I have been using the following for a long time: "convert original_image.png -depth 2 gray:converted_image".

I just changed computer, and re-installed ImageMagick on this new computer using Macports, which installed ImageMagick 6.9.3-4 . On this version of ImageMagick, issuing the command above generates bad output: if the height of the original image is more than its width, then the output of the image becomes square, with the height as the image size. In practice, this means that the output file will be padded with zeroes for each line...

For instance, a 128x1024 input file, which normally creates a 32768 byte raw gray image (128x1024 pixels with 2 pixels per byte) with the command above, now creates a 262144 bytes image (1024x1024 pixels with 2 pixels per byte). Converting "converted image" back to PNG fails with "convert -size 128x1024 -depth 2 gray:converted_image new_image.png" but succeeds with "convert -size 1024x1024 -depth 2 gray:converted_image new_image.png" ...

Is this a known issue? I can share a couple of source images to test, but basically, as long at the height is more than the width, the bug shows up on 6.9.3. It was not there on 6.9.2...

Re: convert to gray always generates square images

Posted: 2016-05-03T13:20:47-07:00
by snibgo
I can't confirm with v6.9.3-7, self-compiled with Cygwin, Q32 HDRI. For example:

Code: Select all

convert -size 128x1024 xc: -depth 2 gray:x.bin
The result x.bin is 32768 bytes.

Re: convert to gray always generates square images

Posted: 2016-05-03T14:36:16-07:00
by fmw42
It works fine for me on IM 6.9.3.7 Q16 Mac OSX. Get 32768 bytes.

What is your platform?