convert to gray always generates square images

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
elafargue
Posts: 1
Joined: 2016-05-03T12:49:41-07:00
Authentication code: 1151

convert to gray always generates square images

Post 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...
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: convert to gray always generates square images

Post 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.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: convert to gray always generates square images

Post by fmw42 »

It works fine for me on IM 6.9.3.7 Q16 Mac OSX. Get 32768 bytes.

What is your platform?
Post Reply