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...
convert to gray always generates square images
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: convert to gray always generates square images
I can't confirm with v6.9.3-7, self-compiled with Cygwin, Q32 HDRI. For example:
The result x.bin is 32768 bytes.
Code: Select all
convert -size 128x1024 xc: -depth 2 gray:x.bin
snibgo's IM pages: im.snibgo.com
- 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
It works fine for me on IM 6.9.3.7 Q16 Mac OSX. Get 32768 bytes.
What is your platform?
What is your platform?