[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #45779] Writing and 8-bit image to BMP produce
From: |
Carnë Draug |
Subject: |
[Octave-bug-tracker] [bug #45779] Writing and 8-bit image to BMP produces a 24-bit bmp |
Date: |
Mon, 24 Aug 2015 14:59:56 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0 Iceweasel/31.8.0 |
Update of bug #45779 (project octave):
Status: Confirmed => Need Info
_______________________________________________________
Follow-up Comment #2:
Matlab documentation on this is very much sparse. My interpretation is that
the 1, 8, and 24 bit format that they support are for boolean, indexed, and
RGB images (8-bit per color channel) respectively.
Octave does check the type of the matrix being saved and supports saving
boolean matrices as 1-bit images. I just tested it and GM seems to respect
it:
$ octave
octave> imwrite (rand(100) > 0.6, "bool.bmp")
octave> exit
$ gm identify -verbose bool.bmp
Image: bool.bmp
Format: BMP (Microsoft Windows bitmap image)
[...]
Type: bilevel
Depth: 1 bits-per-pixel component
Channel Depths:
Gray: 1 bits
[...]
An image with a colormap should be saved as an 8 bit indexed image. In the
following, it seems like both are saved as indexed images, the difference is
that GM seems to identify that the colormap is gray but the image itself is
indexed and 8 bit in both cases:
$ octave
octave> imwrite (randi ([0 255], 100, 100, "uint8"), gray (256),
"with-gray-map.bmp")
octave> imwrite (randi ([0 255], 100, 100, "uint8"), cubehelix (256),
"with-color-map.bmp")
octave> exit
$ gm identify -verbose with-gray-map.bmp
Image: with-gray-map.bmp
Format: BMP (Microsoft Windows bitmap image)
Geometry: 100x100
Class: PseudoClass
Type: grayscale
Depth: 8 bits-per-pixel component
Channel Depths:
Gray: 8 bits
[...]
$ gm identify -verbose with-color-map.bmp
Image: with-color-map.bmp
Format: BMP (Microsoft Windows bitmap image)
Geometry: 100x100
Class: PseudoClass
Type: palette
Depth: 8 bits-per-pixel component
Channel Depths:
Red: 8 bits
Green: 8 bits
Blue: 8 bits
Finally, without a colormap, I'm unsure what should happen for Matlab
compatibility. I think the logical thing would be to save an 8-bit image for
grayscale image and 24-bit (8-bit per channel) for RGB images which seems to
be happening:
$ octave
octave> imwrite (randi ([0 255], 100, 100, 3, "uint8"),
"without-map-rgb.bmp")
octave> imwrite (randi ([0 255], 100, 100, "uint8"), "without-map-gray.bmp")
octave> exit
$ gm identify -verbose without-map-rgb.bmp
Image: without-map-rgb.bmp
Format: BMP (Microsoft Windows bitmap image)
Geometry: 100x100
Class: DirectClass
Type: true color
Depth: 8 bits-per-pixel component
Channel Depths:
Red: 8 bits
Green: 8 bits
Blue: 8 bits
[...]
$ gm identify -verbose without-map-gray.bmp
Image: without-map-gray.bmp
Format: BMP (Microsoft Windows bitmap image)
Geometry: 100x100
Class: DirectClass
Type: grayscale
Depth: 8 bits-per-pixel component
Channel Depths:
Gray: 8 bits
[...]
Unfortunately, `gm identify` is not 100% reliable and I'm not very familiar
with the BMP format either.
So, could you please be a bit more verbose on what exactly should be
happening? 8-bit image means very little as you can see from above.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?45779>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #45779] Writing and 8-bit image to BMP produces a 24-bit bmp, Ian Journeaux, 2015/08/17
- [Octave-bug-tracker] [bug #45779] Writing and 8-bit image to BMP produces a 24-bit bmp, Mike Miller, 2015/08/17
- [Octave-bug-tracker] [bug #45779] Writing and 8-bit image to BMP produces a 24-bit bmp,
Carnë Draug <=
- [Octave-bug-tracker] [bug #45779] Writing and 8-bit image to BMP produces a 24-bit bmp, Ian Journeaux, 2015/08/24
- [Octave-bug-tracker] [bug #45779] Writing and 8-bit image to BMP produces a 24-bit bmp, Ian Journeaux, 2015/08/24
- [Octave-bug-tracker] [bug #45779] Writing and 8-bit image to BMP produces a 24-bit bmp, Avinoam Kalma, 2015/08/24
- [Octave-bug-tracker] [bug #45779] Writing and 8-bit image to BMP produces a 24-bit bmp, Mike Miller, 2015/08/25
- [Octave-bug-tracker] [bug #45779] Writing 8-bit grayscale image to bmp file should write an indexed image, Carnë Draug, 2015/08/25
- [Octave-bug-tracker] [bug #45779] Writing 8-bit grayscale image to bmp file should write an indexed image, Ian Journeaux, 2015/08/25
- [Octave-bug-tracker] [bug #45779] Writing 8-bit grayscale image to bmp file should write an indexed image, Carnë Draug, 2015/08/25