Page 1 of 1

-depth not working?

Posted: 2012-04-05T04:14:59-07:00
by chri
Trying to convert a 24/32bit bmp or jpg to a 8bit bmp using ImageMagick-6.7.6-4-Q16-windows-x64-static with the following commands fail:
convert img.bmp -depth 8 img_new.bmp or
convert img.jpg -depth 8 img_new.bmp

conversion of 8bit bmp or jpg into 8bit bmp fails as well

conversion of 24bit bmp or jpg into 8bit jpg works fine but the -depth option is ignored as well: -depth 16 results in a 8bit jpg as well

using -colorspace Gray before -depth does not change anything

Re: -depth not working?

Posted: 2012-04-05T10:36:44-07:00
by fmw42
try adding -type palette

Re: -depth not working?

Posted: 2012-04-05T12:25:56-07:00
by chri
thanks - useful hint but did not solve the problem

seems its doing something
convert img.bmp -type palette -depth 8 img_new.bmp

filesize is reduced from 880k to 13k, image looks like it should BUT its still 32bit and not 8
convert img.bmp -colorspace Gray -type palette -depth 8 img_new.bmp does not work either

other suggestions?

Re: -depth not working?

Posted: 2012-04-05T13:21:25-07:00
by fmw42
Post a link to your image, so others can test with it. Is your image 32bits for a single channel or 32bits (RGBA each 8bits)?

If you are using alpha in your 32bit RGBA image, then change to -type palettematte.

Also for a list of supported bmp formats (you may need to use an older or newer format), see BMP3:, BMP2:, etc as prefixes on you bmp output. see http://www.imagemagick.org/Usage/formats/#bmp

Re: -depth not working?

Posted: 2012-04-05T13:42:16-07:00
by chri
http://w604232.open.ge.tt/1/files/5btHs ... b?download

the file is generated by an adobe flash app and should be imported into SAP

the problem is I could not get flash to save the bitmap in any other format and import into SAP does not work properly unless the bitmap is 8bit only

Re: -depth not working?

Posted: 2012-04-05T15:17:34-07:00
by fmw42
Your file is already 8-bit grayscale.


identify -verbose ZSWF_CALL_1000000444075000130.bmp
Image: ZSWF_CALL_1000000444075000130.bmp
Format: BMP (Microsoft Windows bitmap image)
Class: DirectClass
Geometry: 550x400+0+0
Resolution: 118.24x118.24
Print size: 4.65156x3.38295
Units: PixelsPerCentimeter
Type: Grayscale
Base type: Grayscale
Endianess: Undefined
Colorspace: sRGB
Depth: 8-bit
Channel depth:
gray: 8-bit
Channel statistics:
Gray:
min: 0 (0)
max: 255 (1)
mean: 249.465 (0.978292)
standard deviation: 35.2135 (0.138092)
kurtosis: 41.796
skewness: -6.53415

Colors: 124
Histogram:
3369: ( 0, 0, 0) #000000 black
133: ( 1, 1, 1) #010101 srgb(1,1,1)
1: ( 2, 2, 2) #020202 srgb(2,2,2)
1: ( 5, 5, 5) #050505 grey2
1: ( 6, 6, 6) #060606 srgb(6,6,6)
1: ( 7, 7, 7) #070707 srgb(7,7,7)
1: ( 9, 9, 9) #090909 srgb(9,9,9)
3: ( 10, 10, 10) #0A0A0A grey4
2: ( 11, 11, 11) #0B0B0B srgb(11,11,11)
1: ( 13, 13, 13) #0D0D0D grey5
1: ( 14, 14, 14) #0E0E0E srgb(14,14,14)
174: ( 16, 16, 16) #101010 srgb(16,16,16)
6: ( 20, 20, 20) #141414 grey8
1: ( 23, 23, 23) #171717 grey9
2: ( 24, 24, 24) #181818 srgb(24,24,24)
1: ( 25, 25, 25) #191919 srgb(25,25,25)
1: ( 27, 27, 27) #1B1B1B srgb(27,27,27)
3: ( 28, 28, 28) #1C1C1C grey11
2: ( 29, 29, 29) #1D1D1D srgb(29,29,29)
1: ( 30, 30, 30) #1E1E1E srgb(30,30,30)
1: ( 31, 31, 31) #1F1F1F grey12
116: ( 32, 32, 32) #202020 srgb(32,32,32)
6: ( 35, 35, 35) #232323 srgb(35,35,35)
1: ( 37, 37, 37) #252525 srgb(37,37,37)
1: ( 44, 44, 44) #2C2C2C srgb(44,44,44)
90: ( 48, 48, 48) #303030 grey19
2: ( 50, 50, 50) #323232 srgb(50,50,50)
2: ( 51, 51, 51) #333333 grey20
1: ( 53, 53, 53) #353535 srgb(53,53,53)
1: ( 57, 57, 57) #393939 srgb(57,57,57)
159: ( 64, 64, 64) #404040 grey25
1: ( 65, 65, 65) #414141 srgb(65,65,65)
1: ( 66, 66, 66) #424242 grey26
1: ( 67, 67, 67) #434343 srgb(67,67,67)
1: ( 70, 70, 70) #464646 srgb(70,70,70)
1: ( 71, 71, 71) #474747 grey28
1: ( 74, 74, 74) #4A4A4A grey29
1: ( 75, 75, 75) #4B4B4B srgb(75,75,75)
1: ( 76, 76, 76) #4C4C4C srgb(76,76,76)
1: ( 77, 77, 77) #4D4D4D grey30
4: ( 78, 78, 78) #4E4E4E srgb(78,78,78)
1: ( 79, 79, 79) #4F4F4F grey31
72: ( 80, 80, 80) #505050 srgb(80,80,80)
1: ( 81, 81, 81) #515151 srgb(81,81,81)
1: ( 82, 82, 82) #525252 grey32
1: ( 84, 84, 84) #545454 grey33
1: ( 88, 88, 88) #585858 srgb(88,88,88)
2: ( 92, 92, 92) #5C5C5C grey36
138: ( 96, 96, 96) #606060 srgb(96,96,96)
1: ( 97, 97, 97) #616161 grey38
1: (100,100,100) #646464 srgb(100,100,100)
1: (101,101,101) #656565 srgb(101,101,101)
1: (102,102,102) #666666 grey40
2: (104,104,104) #686868 srgb(104,104,104)
1: (107,107,107) #6B6B6B grey42
2: (111,111,111) #6F6F6F srgb(111,111,111)
66: (112,112,112) #707070 grey44
1: (114,114,114) #727272 srgb(114,114,114)
1: (115,115,115) #737373 grey45
3: (117,117,117) #757575 grey46
1: (125,125,125) #7D7D7D grey49
762: (128,128,128) #808080 fractal
1: (132,132,132) #848484 srgb(132,132,132)
1: (133,133,133) #858585 grey52
1: (134,134,134) #868686 srgb(134,134,134)
1: (138,138,138) #8A8A8A grey54
85: (144,144,144) #909090 srgb(144,144,144)
1: (145,145,145) #919191 grey57
2: (146,146,146) #929292 srgb(146,146,146)
1: (148,148,148) #949494 grey58
1: (149,149,149) #959595 srgb(149,149,149)
1: (150,150,150) #969696 grey59
1: (153,153,153) #999999 grey60
1: (156,156,156) #9C9C9C grey61
1: (159,159,159) #9F9F9F srgb(159,159,159)
118: (160,160,160) #A0A0A0 srgb(160,160,160)
1: (161,161,161) #A1A1A1 grey63
1: (162,162,162) #A2A2A2 srgb(162,162,162)
1: (165,165,165) #A5A5A5 srgb(165,165,165)
1: (166,166,166) #A6A6A6 grey65
1: (167,167,167) #A7A7A7 srgb(167,167,167)
1: (170,170,170) #AAAAAA srgb(170,170,170)
1: (171,171,171) #ABABAB grey67
2: (173,173,173) #ADADAD grey68
1: (174,174,174) #AEAEAE srgb(174,174,174)
77: (176,176,176) #B0B0B0 grey69
1: (179,179,179) #B3B3B3 grey70
1: (182,182,182) #B6B6B6 srgb(182,182,182)
170: (192,192,192) #C0C0C0 silver
1: (194,194,194) #C2C2C2 grey76
1: (195,195,195) #C3C3C3 srgb(195,195,195)
1: (197,197,197) #C5C5C5 srgb(197,197,197)
1: (198,198,198) #C6C6C6 srgb(198,198,198)
1: (199,199,199) #C7C7C7 grey78
1: (205,205,205) #CDCDCD srgb(205,205,205)
1: (206,206,206) #CECECE srgb(206,206,206)
104: (208,208,208) #D0D0D0 srgb(208,208,208)
1: (210,210,210) #D2D2D2 srgb(210,210,210)
1: (212,212,212) #D4D4D4 grey83
1: (214,214,214) #D6D6D6 grey84
2: (216,216,216) #D8D8D8 srgb(216,216,216)
3: (217,217,217) #D9D9D9 grey85
1: (219,219,219) #DBDBDB grey86
1: (220,220,220) #DCDCDC gainsboro
1: (223,223,223) #DFDFDF srgb(223,223,223)
110: (224,224,224) #E0E0E0 grey88
2: (228,228,228) #E4E4E4 srgb(228,228,228)
2: (231,231,231) #E7E7E7 srgb(231,231,231)
2: (232,232,232) #E8E8E8 grey91
1: (235,235,235) #EBEBEB grey92
1: (237,237,237) #EDEDED grey93
1: (238,238,238) #EEEEEE srgb(238,238,238)
2: (239,239,239) #EFEFEF srgb(239,239,239)
174: (240,240,240) #F0F0F0 grey94
1: (241,241,241) #F1F1F1 srgb(241,241,241)
1: (242,242,242) #F2F2F2 grey95
2: (245,245,245) #F5F5F5 grey96
1: (246,246,246) #F6F6F6 srgb(246,246,246)
1: (248,248,248) #F8F8F8 srgb(248,248,248)
2: (249,249,249) #F9F9F9 srgb(249,249,249)
1: (250,250,250) #FAFAFA grey98
2: (252,252,252) #FCFCFC grey99
2: (254,254,254) #FEFEFE srgb(254,254,254)
213937: (255,255,255) #FFFFFF white
Rendering intent: Perceptual
Gamma: 0.45455
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)
Interlace: None
Background color: white
Border color: srgb(223,223,223)
Matte color: grey74
Transparent color: black
Compose: Over
Page geometry: 550x400+0+0
Dispose: Undefined
Iterations: 0
Compression: Undefined
Orientation: Undefined
Properties:
date:create: 2012-04-05T15:13:08-07:00
date:modify: 2012-04-05T13:35:36-07:00
signature: 9f3bbd05c5a708d26b64517e99a6c9a47d3370c9f912182e6d0350702411c77e
Artifacts:
filename: ZSWF_CALL_1000000444075000130.bmp
verbose: true
Tainted: False
Filesize: 880KB
Number pixels: 220K
Pixels per second: 22MB
User time: 0.000u
Elapsed time: 0:01.009
Version: ImageMagick 6.7.6-4 2012-04-04 Q16 http://www.imagemagick.org


Only thing I can think of is to convert to BMP3 or BMP2

convert ZSWF_CALL_1000000444075000130.bmp BMP3:ZSWF_CALL_1000000444075000130A.bmp

or

convert ZSWF_CALL_1000000444075000130.bmp BMP2:ZSWF_CALL_1000000444075000130B.bmp

and see if they get imported correctly.