Saving image as a palette type bmp, even if it is greyscale?
Posted: 2018-04-11T11:52:13-07:00
Hi!
I'm trying to convert a PNG to BMP, with the explicit requirement, that the file must be a palette type BMP3.
You see, the u-boot bootloader can only display palette BMP's, but imagemagick keeps turning the output into a grayscale type image. I think there might be some automatic conversion done to save space, but the result is that the image can't be displayed.
Does anyone know how to force the output to be a palette format?
Command used was:
This is a file that u-boot can display:
I'm trying to convert a PNG to BMP, with the explicit requirement, that the file must be a palette type BMP3.
You see, the u-boot bootloader can only display palette BMP's, but imagemagick keeps turning the output into a grayscale type image. I think there might be some automatic conversion done to save space, but the result is that the image can't be displayed.
Does anyone know how to force the output to be a palette format?
Command used was:
Code: Select all
$ convert -verbose boot_logo.png -type palette BMP3:boot.bmp
boot_logo.png PNG 320x240 320x240+0+0 8-bit sRGB 22.3KB 0.000u 0:00.000
boot_logo.png=>boot.bmp PNG 320x240 320x240+0+0 8-bit Palette sRGB 238c 19.8KB 0.070u 0:00.059
Code: Select all
$ identify -verbose boot.bmp
Image: boot.bmp
Format: BMP3 (Microsoft Windows bitmap image (V3))
Class: PseudoClass
Geometry: 320x240+0+0
Units: PixelsPerCentimeter
Type: Grayscale
Endianess: Undefined
Colorspace: sRGB
Depth: 8-bit
Channel depth:
gray: 8-bit
Channel statistics:
Pixels: 76800
Gray:
min: 0 (0)
max: 237 (0.929412)
mean: 24.8867 (0.097595)
standard deviation: 67.5699 (0.26498)
kurtosis: 4.44979
skewness: 2.49846
entropy: 0.174434
Colors: 238
Histogram:
65964: ( 0, 0, 0) #000000 gray(0)
40: ( 1, 1, 1) #010101 gray(1)
...
Colormap entries: 256
Colormap:
0: ( 0, 0, 0) #000000 gray(0)
1: ( 1, 1, 1) #010101 gray(1)
...
Rendering intent: Perceptual
Gamma: 0.454545
Chromaticity:
red primary: (0.64,0.33)
green primary: (0.3,0.6)
blue primary: (0.15,0.06)
white point: (0.3127,0.329)
Background color: gray(255)
Border color: gray(223)
Matte color: gray(189)
Transparent color: gray(0)
Interlace: None
Intensity: Undefined
Compose: Over
Page geometry: 320x240+0+0
Dispose: Undefined
Iterations: 0
Compression: RLE
Orientation: Undefined
Properties:
date:create: 2018-04-11T20:52:40+02:00
date:modify: 2018-04-11T20:52:40+02:00
signature: 05cdd6fa8c6ff1bee79a6e96819d16233726fb537b384a0b212055737088318c
Artifacts:
filename: boot.bmp
verbose: true
Tainted: False
Filesize: 19.8KB
Number pixels: 76.8K
User time: 0.000u
Elapsed time: 0:01.000
Version: ImageMagick 6.9.7-4 Q16 x86_64 20170114 http://www.imagemagick.org
Code: Select all
$ identify -verbose boot-backup.bmp
Image: boot-backup.bmp
Format: BMP3 (Microsoft Windows bitmap image (V3))
Class: DirectClass
Geometry: 320x240+0+0
Units: PixelsPerCentimeter
Type: Palette
Endianess: Undefined
Colorspace: sRGB
Depth: 8-bit
Channel depth:
red: 8-bit
green: 8-bit
blue: 8-bit
Channel statistics:
Pixels: 76800
Red:
min: 0 (0)
max: 247 (0.968627)
mean: 10.7822 (0.042283)
standard deviation: 47.954 (0.188055)
kurtosis: 18.3298
skewness: 4.4539
entropy: 0.121676
Green:
min: 0 (0)
max: 247 (0.968627)
mean: 3.19845 (0.0125429)
standard deviation: 23.4586 (0.0919945)
kurtosis: 87.1343
skewness: 9.20918
entropy: 0.115328
Blue:
min: 0 (0)
max: 249 (0.976471)
mean: 2.70246 (0.0105979)
standard deviation: 23.5542 (0.0923692)
kurtosis: 89.5192
skewness: 9.39096
entropy: 0.0532598
Image statistics:
Overall:
min: 0 (0)
max: 249 (0.976471)
mean: 5.56103 (0.021808)
standard deviation: 33.6882 (0.132111)
kurtosis: 42.7356
skewness: 6.62803
entropy: 0.0967545
Colors: 16
Histogram:
72588: ( 0, 0, 0) #000000 black
161: ( 26, 18, 18) #1A1212 srgb(26,18,18)
212: ( 59, 3, 0) #3B0300 srgb(59,3,0)
200: ( 59, 59, 59) #3B3B3B grey23
66: ( 85, 85, 86) #555556 srgb(85,85,86)
85: ( 86, 5, 0) #560500 srgb(86,5,0)
159: (121, 7, 0) #790700 srgb(121,7,0)
110: (121,121,122) #79797A srgb(121,121,122)
54: (146,147,148) #929394 srgb(146,147,148)
94: (152, 9, 0) #980900 srgb(152,9,0)
157: (187,188,190) #BBBCBE srgb(187,188,190)
218: (188, 12, 0) #BC0C00 srgb(188,12,0)
91: (225, 14, 0) #E10E00 srgb(225,14,0)
84: (225,226,228) #E1E2E4 srgb(225,226,228)
469: (246,247,249) #F6F7F9 srgb(246,247,249)
2052: (247, 16, 0) #F71000 srgb(247,16,0)
Rendering intent: Perceptual
Gamma: 0.454545
Chromaticity:
red primary: (0.64,0.33)
green primary: (0.3,0.6)
blue primary: (0.15,0.06)
white point: (0.3127,0.329)
Background color: white
Border color: srgb(223,223,223)
Matte color: grey74
Transparent color: black
Interlace: None
Intensity: Undefined
Compose: Over
Page geometry: 320x240+0+0
Dispose: Undefined
Iterations: 0
Compression: None
Orientation: Undefined
Properties:
date:create: 2018-04-11T17:21:06+02:00
date:modify: 2018-04-11T17:21:06+02:00
signature: 19cdc82c1e831800ec578ceff8a086ded5e35b2a1c6f09486f0595bbc91b147d
Artifacts:
filename: boot-backup.bmp
verbose: true
Tainted: False
Filesize: 230KB
Number pixels: 76.8K
User time: 0.000u
Elapsed time: 0:01.000
Version: ImageMagick 6.9.7-4 Q16 x86_64 20170114 http://www.imagemagick.org