Hi,
I have been told that IM cannot save a BMP file with a 16 bit pixel resolution ie each pixel is represented by 2 bytes with RGB stored as 5:6:5. It can however read files with this format.
See link to the thread discussing this.
viewtopic.php?f=1&t=33334&sid=6ceff1fda ... 1a38826f62
I would like to suggest a modification to IM that would support this format, obviously colour depth may possibly be lost as the most LSB's of the colour info would have to be dropped. In my case as these bits never existed as the files started out as 5:6:5 its not a problem. The reason that this is important to me is that I am using a lot of graphics files in a small embedded application and image size is very important to me.
Here is a link to a .BMP file I am using that is stored with a 16 bit pixel size.
https://www.dropbox.com/s/flhoni3vjn9ry ... 2.BMP?dl=0
Regards, Martin
Saving a BMP file with 16 bit pixel resolution (5:6:5)
Re: Saving a BMP file with 16 bit pixel resolution (5:6:5)
Maybe you should read your topic again?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Saving a BMP file with 16 bit pixel resolution (5:6:5)
The file you posted is 24bits. BMP3 does not support the 5:6:5 format, since it does not have fields in the header to identify it as such. Whereas, BMP (BMP4) does contain such headers. If you have an example BMP3 file in 5:6:5 format, post that so the developers can see how it can be identified as such.
Re: Saving a BMP file with 16 bit pixel resolution (5:6:5)
I could not figure out how to download mch's example file with a web browser. What I ended up with was always either a JPEG or HTML file. I was able to download it with wget. It is BMPv3 16-bit RGB555, not RGB565.
BMPv3 supports 16-bit images with arbitrary RGB (though not RGBA) color formats. You just have to write an extra "BITFIELDS" segment after the header, for any format other than RGB555. ImageMagick can read such images, but can't write them.
If IM were to support writing BMPv3 RGB565, it ought to support RGB555 as well, since it also has the "bmp:subtype=RGB555" option.
Even if it does not support these things, I'd say it should ignore the options completely, instead of producing malformed files as it does now.
Format reference
Examples:
RGB565
RGB555 without BITFIELDS
RGB555 with BITFIELDS
BMPv3 supports 16-bit images with arbitrary RGB (though not RGBA) color formats. You just have to write an extra "BITFIELDS" segment after the header, for any format other than RGB555. ImageMagick can read such images, but can't write them.
If IM were to support writing BMPv3 RGB565, it ought to support RGB555 as well, since it also has the "bmp:subtype=RGB555" option.
Even if it does not support these things, I'd say it should ignore the options completely, instead of producing malformed files as it does now.
Format reference
Examples:
RGB565
RGB555 without BITFIELDS
RGB555 with BITFIELDS
Re: Saving a BMP file with 16 bit pixel resolution (5:6:5)
Sorry I had assumed it was 5:6:5 as i didnt know there was an option for 5:5:5. I did know it only used 16 bits to store each pixel rather than 24.
The original post has been added to since i posted this question on the developers forum.
So am I right in thinking that IM does not support the writing of this format?
Is it likely/possible that this will be added in the future
The original post has been added to since i posted this question on the developers forum.
So am I right in thinking that IM does not support the writing of this format?
Is it likely/possible that this will be added in the future
Re: Saving a BMP file with 16 bit pixel resolution (5:6:5)
Sorry, Just re-read the original post and find it is supported, just wasnt documented.
I have tried this and it works.
>magick convert cam1.bmp -define bmp:subtype=RGB565 test.bmp
Great product!!
I have tried this and it works.
>magick convert cam1.bmp -define bmp:subtype=RGB565 test.bmp
Great product!!
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Saving a BMP file with 16 bit pixel resolution (5:6:5)
I had noted above that it was supported for BMP (BMP4), but not for BMP3. See also documentation for that at https://www.imagemagick.org/script/comm ... php#define
Re: Saving a BMP file with 16 bit pixel resolution (5:6:5)
If you want an example of an image in BMP3 format that does 16-bit RGB565 (it's actually BGR565), then: here's an example. The format is popular on the GBA (and probably similar systems) because with a negative height and no compression it makes for a pretty trivial usable and most interchangeable bitmap format.
Edit: Sorry, should more carefully read the spec given.
Edit: Sorry, should more carefully read the spec given.