Page 1 of 1

bug: mogrify -colorspace Gray *.tif (or *.bmp, etc.)

Posted: 2007-09-07T12:34:17-07:00
by fbechter
I am new to ImageMagick and command line prompts, but have picked up on Mogrify quickly, and love it. I'm not sure how to check the version number (I downloaded it last week), but the installation file I downloaded is named 6.3.5-6-Q8-windows-dll. (My Windows version is XP, Home Edition 2002, Service Pack 2.) Various commands I've tried work great, EXCEPT:

mogrify -colorspace Gray *.tif

When executing this command, I can actually SEE the thumbnail of the photo (in a viewer in Windows) quickly "blink" (disappear and reappear), so I know the computer THINKS it's doing the command. However, the image remains exactly the same (i.e., RGB color); no changes.

To troubleshoot, I did the same command on the same photos on a Unix system where I have an account. Works just fine. (I don't know what version of the program is on that system.)

After converting all of the images to grayscale on the Unix system, and then bringing them all back to my Windows machine, I noticed: They had all been changed from 333dpi/1-inch-wide to 72dpi/5-inches-wide (thus, no loss in quality, I don't think). (Thus, I had to resample and resize them. Note: these Mogrify commands work just fine on my Windows machine.)

This made me wonder if the -colorspace Gray command requires a 72 dpi image. So I tried the command on 72 dpi bitmap images: mogrify -colorspace Gray *.bmp. No luck. Same result: the computer acts like its doing the command (requires time to do it, etc.), and I receive no error message. BUT the images are exactly the same as before executing the command (in this case, bitmap color).

By the way, I have also tried various capitalizations of "Gray" (gray, GRAY, Gray). Also, although my filenames do have spaces in them, still, this did not hamper any of the other commands (-format, -resample, -resize, -modulate, -shave, +contrast, etc.).

Please do let me know if it seems like a real bug (or not). Hope you can help.

Perhaps related: I tried -colorspace CMYK just to see what would happen. When checking the image in Photoshop, it seemed like I was given only one plate (not all four). I'm not sure about this (I don't know the ins and outs of 4-color processing in Photoshop), but you might check CMYK as well, just in case.

Thanks, Frank B.

Re: bug: mogrify -colorspace Gray *.tif (or *.bmp, etc.)

Posted: 2007-10-13T11:07:54-07:00
by dmafackler
Version checking:
mogrify -version

e.g. I get this with the last release I installed. Never hurts to download the latest version and see if a few more issues have been fixed (6.3.6-1 is out...).

"Version: ImageMagick 6.3.5 09/01/07 Q8 ..."

Valid values for colorspace:
(IM is case insensitive, even though the list is provided in cased form.)

identify -list colorspace


A potential work-around to try, and maybe still save a round-trip to your providers box [from the Windows XP command-line]:

for %x in (*.tif) do convert %x -format jpg -colorspace gray %~nx.jpg

Converts a set of TIFs to JPG, reset colorspace, writes file.
%x substitutes the full filename
%~nx substitutes filename minus the . and extension (see "for /?" on DOS command-line)


Confirmed:
* Found that "mogrify -colorspace gray *.jpg" works fine--for JPEGs--in the version I'm using.
* "mogrify and convert DO have trouble with the bmp and tifs I generated from same jpg's via IM.
"convert: Caution: quantization tables are too coarse for baseline JPEG. `JPEGLib`"

Curiosity:
What tools are generating your TIFs?
Specification for TIFs is neither as precise or rigid as some of the newer image formats (PNG, JPG). Often problems can be traced to one vendors implementation choice vs anothers.

Re: bug: mogrify -colorspace Gray *.tif (or *.bmp, etc.)

Posted: 2007-10-13T13:50:26-07:00
by fbechter
RE: Curiosity: What tools are generating your TIFs?

The TIFs were generated through Mogrify, from BMPs. The BMPs were generated though Adobe Premiere, i.e., they are extracted frames from a video.

Many thanks for the possible work-around. I will try converting the BMPs to JPG first.