Can't Convert grayscale bmp to color jpg

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
abinns
Posts: 4
Joined: 2014-04-22T06:37:14-07:00
Authentication code: 6789

Can't Convert grayscale bmp to color jpg

Post by abinns »

Using 64-bit Windows Server 2008 R2 Standard, and ImageMagick 6.6.9-Q16

Using the command-line tool with this statement:

mogrify -format jpg -colors 256 -type Bilevel [filename].bmp

The original colorspace is RGB. Original depth is 8. These values are retained when the image is converted. I have tried -type Palette, -type TrueColor. I have tried specifying colorspace and depth, although these are correct originally. Please advise. Thank you.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Can't Convert grayscale bmp to color jpg

Post by snibgo »

I don't understand what problem you have.

"-type bilevel" should reduce the colours to 2 (black and white), so "-colors 256" is pointless.

Your version of IM is very old.
snibgo's IM pages: im.snibgo.com
abinns
Posts: 4
Joined: 2014-04-22T06:37:14-07:00
Authentication code: 6789

Re: Can't Convert grayscale bmp to color jpg

Post by abinns »

That is interesting. When I save the bmp as 256-color bmp, and run -identify against the resulting file, it shows Type and Base Type as "Bilevel", which is the reason I added that specification. I am hesitant to upgrade because we have other processes using the current version. Would an upgrade help?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Can't Convert grayscale bmp to color jpg

Post by snibgo »

Would an upgrade help what? What problem are you trying to solve? What is going wrong?
snibgo's IM pages: im.snibgo.com
abinns
Posts: 4
Joined: 2014-04-22T06:37:14-07:00
Authentication code: 6789

Re: Can't Convert grayscale bmp to color jpg

Post by abinns »

I am asking if upgrading would help to resolve the problem I originally posted. No matter what specs I try, I cannot find a way to produce a 256 color jpg from a Bilevel, RGB, 8-bit depth .bmp image. The Type and Base Type always come out as Grayscale in the resulting jpg file. I am using Mogrify, not Convert.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Can't Convert grayscale bmp to color jpg

Post by snibgo »

As far as I know, "a 256 color jpg" doesn't exist. JPEGs have essentially two formats: 8-bit greyscale, and 3x8-bit colour. If your image has colours, it will become a 24-bit JPEG. If it has no colours it will become a greyscale JPEG.
snibgo's IM pages: im.snibgo.com
abinns
Posts: 4
Joined: 2014-04-22T06:37:14-07:00
Authentication code: 6789

Re: Can't Convert grayscale bmp to color jpg

Post by abinns »

You can probably tell by now I'm no graphics expert! I appreciate your help. Are you saying that regardless what command-line specification I set, if the image has no basic color in it but black, that it is going to come out as Grayscale? If so, then setting specifications is the real issue. For my purpose, an uncompressed 1-bit tif in black and white is also acceptable. However, I am having a similar problem setting a specification for that also, because the resulting file continues to show colorspace = RGB even though I specified -colorspace "Gray". Tell me, do the values we want to assign to the specifications have to be enclosed in quotes?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Can't Convert grayscale bmp to color jpg

Post by snibgo »

If your image has only black and white, then "-format tiff" in mogrify should create an uncompressed 1-bit tiff. It does for me, IM v6.8.9-0 on Windows 8.1.
snibgo's IM pages: im.snibgo.com
Post Reply