Hi,
I'm not sure if this is an accidental bug or just how bmps work in this version of ImageMagick but it's an issue.
I'm trying to convert a color PDF to a 500ppi grayscale bmp. I'm 90% of the way there but I'm having some issues with the bmp color palette. My bmp looks right and when I use identify -verbose everything in there looks fine but if I open the bmp using a hex editor I can see that the color palette still contains colors which means my receiving program rejects it.
I'm using convert -compress None -type GrayScale -colors 256 -density 500 test.pdf test.bmp
I've tried using -colors 256 +dither -treedepth 8 based on a few things a saw in other forums but it made no difference. I tried using -remap with a bmp that I knew had the right color palette, I tried converting the pdf to a pgm first, I tried converting to a ps first, I always get the wrong color palette. I'd really appreciate any help possible on this.
The color palette actually starts with three colors, red, green, blue, and then puts the letters sRGB in then goes on to have the normal grayscale color palette (01 01 01 00 02 02 02 00 etc.) This isn't standard BMP format as far as I know and suggests that this is a bug whether or not it usually affects peoples ability to use the BMP.
BMP Color Palette
-
- Posts: 4
- Joined: 2012-08-09T05:59:49-07:00
- Authentication code: 67789
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: BMP Color Palette
I don't know much about BMP format, but there are two older formats that you can try BMP3: and BMP2:, e.g.
convert -compress None -type GrayScale -colors 256 -density 500 test.pdf BMP3:test.bmp
I do not know if that will help
convert -compress None -type GrayScale -colors 256 -density 500 test.pdf BMP3:test.bmp
I do not know if that will help
-
- Posts: 4
- Joined: 2012-08-09T05:59:49-07:00
- Authentication code: 67789
Re: BMP Color Palette
Thanks, it looks like bmp3 gives you the right color palette. I'd experimented with the different types a little but didn't see any differences at first.
Can some sort of note get added to the descriptions of the different formats so that no one else will have this problem?
Can some sort of note get added to the descriptions of the different formats so that no one else will have this problem?
Re: BMP Color Palette
The problem isn't the palette, it's that whatever you're using to view or analyze the file does not understand the v4 or v5 BMP format that ImageMagick used. Most applications handle it well enough, but there are exceptions.
I do think it's fair to argue that the documentation should mention that v3 is more portable, or even that the default BMP version should be v3.
Since we're on the topic, the documentation is incomplete when it states that version 4 is the default. It actually selects either v4 or v5, depending on the image.
I do think it's fair to argue that the documentation should mention that v3 is more portable, or even that the default BMP version should be v3.
Since we're on the topic, the documentation is incomplete when it states that version 4 is the default. It actually selects either v4 or v5, depending on the image.
-
- Posts: 4
- Joined: 2012-08-09T05:59:49-07:00
- Authentication code: 67789
Re: BMP Color Palette
I agree that part of my problem is the program reading it in but you are wrong about the palette not bring the actual issue. If you open up the bmp IN A HEX EDITOR and look at the color palette (it starts at 0x0036) for the default bmp you get three colors, red, green, and blue, and the letters sRGB in ASCII and THEN the regular bmp grayscale color palette starts up.
True, most programs don't care but this is still not the standard which was all I wanted.
True, most programs don't care but this is still not the standard which was all I wanted.
Re: BMP Color Palette
A BMP palette can start at byte 0x1a, 0x36, 0x42, 0x7a, or 0x8a.
When I create a BMP file with 'convert', I usually see ASCII "BGRs" at offset 0x46, and the palette starts at offset 0x8a.
If you get a different result, or believe that that is invalid (as opposed to just unusual), then we probably need more information from you.
When I create a BMP file with 'convert', I usually see ASCII "BGRs" at offset 0x46, and the palette starts at offset 0x8a.
If you get a different result, or believe that that is invalid (as opposed to just unusual), then we probably need more information from you.