IM sees your first image as bilevel with alpha.
identify -verbose ce82e79268.png
Image: ce82e79268.png
Format: PNG (Portable Network Graphics)
Class: DirectClass
Geometry: 246x92+0+0
Resolution: 28.35x28.35
Print size: 8.67725x3.24515
Units: PixelsPerCentimeter
Type: Bilevel
Base type: Bilevel
Endianess: Undefined
Colorspace: RGB
Depth: 8-bit
Channel depth:
gray: 1-bit
alpha: 8-bit
Channel statistics:
Gray:
min: 0 (0)
max: 0 (0)
mean: 0 (0)
standard deviation: -0 (-0)
kurtosis: 0
skewness: 0
Alpha:
min: 0 (0)
max: 255 (1)
mean: 33.2852 (0.13053)
standard deviation: 85.3677 (0.334775)
kurtosis: 2.85234
skewness: -2.19845
Alpha: none #00000000
Histogram:
19549: ( 0, 0, 0, 0) #00000000 none
2819: ( 0, 0, 0,255) #000000 black
55: ( 0, 0, 0, 65) #00000041 rgba(0,0,0,0.254902)
48: ( 0, 0, 0,247) #000000F7 rgba(0,0,0,0.968627)
47: ( 0, 0, 0, 73) #00000049 rgba(0,0,0,0.286275)
27: ( 0, 0, 0,244) #000000F4 rgba(0,0,0,0.956863)
26: ( 0, 0, 0, 29) #0000001D rgba(0,0,0,0.113725)
3: ( 0, 0, 0,237) #000000ED rgba(0,0,0,0.929412)
3: ( 0, 0, 0,243) #000000F3 rgba(0,0,0,0.952941)
3: ( 0, 0, 0,254) #000000FE rgba(0,0,0,0.996078)
2: ( 0, 0, 0, 1) #00000001 rgba(0,0,0,0.00392157)
2: ( 0, 0, 0, 45) #0000002D rgba(0,0,0,0.176471)
2: ( 0, 0, 0,249) #000000F9 rgba(0,0,0,0.976471)
2: ( 0, 0, 0, 20) #00000014 rgba(0,0,0,0.0784314)
2: ( 0, 0, 0, 16) #00000010 rgba(0,0,0,0.0627451)
2: ( 0, 0, 0, 4) #00000004 rgba(0,0,0,0.0156863)
2: ( 0, 0, 0,252) #000000FC rgba(0,0,0,0.988235)
1: ( 0, 0, 0,150) #00000096 rgba(0,0,0,0.588235)
1: ( 0, 0, 0,146) #00000092 rgba(0,0,0,0.572549)
1: ( 0, 0, 0,137) #00000089 rgba(0,0,0,0.537255)
1: ( 0, 0, 0,123) #0000007B rgba(0,0,0,0.482353)
1: ( 0, 0, 0,116) #00000074 rgba(0,0,0,0.454902)
1: ( 0, 0, 0,115) #00000073 rgba(0,0,0,0.45098)
1: ( 0, 0, 0,113) #00000071 rgba(0,0,0,0.443137)
1: ( 0, 0, 0,111) #0000006F rgba(0,0,0,0.435294)
1: ( 0, 0, 0, 95) #0000005F rgba(0,0,0,0.372549)
1: ( 0, 0, 0, 87) #00000057 rgba(0,0,0,0.341176)
1: ( 0, 0, 0, 63) #0000003F rgba(0,0,0,0.247059)
1: ( 0, 0, 0, 58) #0000003A rgba(0,0,0,0.227451)
1: ( 0, 0, 0, 52) #00000034 rgba(0,0,0,0.203922)
1: ( 0, 0, 0, 53) #00000035 rgba(0,0,0,0.207843)
1: ( 0, 0, 0, 37) #00000025 rgba(0,0,0,0.145098)
1: ( 0, 0, 0, 31) #0000001F rgba(0,0,0,0.121569)
1: ( 0, 0, 0, 28) #0000001C rgba(0,0,0,0.109804)
1: ( 0, 0, 0, 21) #00000015 rgba(0,0,0,0.0823529)
1: ( 0, 0, 0,
#00000008 rgba(0,0,0,0.0313725)
1: ( 0, 0, 0, 6) #00000006 rgba(0,0,0,0.0235294)
1: ( 0, 0, 0, 3) #00000003 rgba(0,0,0,0.0117647)
1: ( 0, 0, 0, 10) #0000000A rgba(0,0,0,0.0392157)
1: ( 0, 0, 0,250) #000000FA rgba(0,0,0,0.980392)
1: ( 0, 0, 0,242) #000000F2 rgba(0,0,0,0.94902)
1: ( 0, 0, 0,233) #000000E9 rgba(0,0,0,0.913725)
1: ( 0, 0, 0,229) #000000E5 rgba(0,0,0,0.898039)
1: ( 0, 0, 0,227) #000000E3 rgba(0,0,0,0.890196)
1: ( 0, 0, 0,224) #000000E0 rgba(0,0,0,0.878431)
1: ( 0, 0, 0,221) #000000DD rgba(0,0,0,0.866667)
1: ( 0, 0, 0,218) #000000DA rgba(0,0,0,0.854902)
1: ( 0, 0, 0,214) #000000D6 rgba(0,0,0,0.839216)
1: ( 0, 0, 0,209) #000000D1 rgba(0,0,0,0.819608)
1: ( 0, 0, 0,208) #000000D0 rgba(0,0,0,0.815686)
1: ( 0, 0, 0,203) #000000CB rgba(0,0,0,0.796078)
1: ( 0, 0, 0,169) #000000A9 rgba(0,0,0,0.662745)
1: ( 0, 0, 0,164) #000000A4 rgba(0,0,0,0.643137)
1: ( 0, 0, 0,157) #0000009D rgba(0,0,0,0.615686)
1: ( 0, 0, 0,154) #0000009A rgba(0,0,0,0.603922)
But
convert ce82e79268.png -format "%[channels]" info:
rgba
Channels probably will only be rgb, rgba, cmyk and cmyka. Not sure if it will ever say gray or graya.
I think in this case you really want colorspace:
convert ce82e79268.png -format "%[colorspace]" info:
Gray
in combination with
convert ce82e79268.png -format "%A" info:
True
or just
convert ce82e79268.png -format "%r" info:
DirectClassGrayMatte
But these are not distinguishing gray from bilevel. They see it as gray, but ignore the 1-bit part that makes it bilevel.
Your other image also shows bilevel with alpha.
identify -verbose cef2630f96.png
Image: cef2630f96.png
Format: PNG (Portable Network Graphics)
Class: PseudoClass
Geometry: 246x92+0+0
Resolution: 28.35x28.35
Print size: 8.67725x3.24515
Units: PixelsPerCentimeter
Type: Bilevel
Base type: Bilevel
Endianess: Undefined
Colorspace: RGB
Depth: 8-bit
Channel depth:
gray: 1-bit
alpha: 8-bit
Channel statistics:
Gray:
min: 0 (0)
max: 0 (0)
mean: 0 (0)
standard deviation: -0 (-0)
kurtosis: 0
skewness: 0
Alpha:
min: 0 (0)
max: 255 (1)
mean: 33.2852 (0.13053)
standard deviation: 85.3677 (0.334775)
kurtosis: 2.85234
skewness: -2.19845
It says the channel is gray, but it is only 1-bit, so bilevel.
In IM, it has colorspace RGB, because there are always 3 colors, but in this case they are all the same, so IM knows it is gray (or bilevel b/w if only 1-bit). Your other software is probably seeing all three colors (channels), but not determining that they are all the same. This may be because PNG perhaps does not support a true grayscale type. But I am not an expert on PNG.
I would trust the IM type from the verbose info, plus the alpha.
type=`identify -verbose ce82e79268.png | sed -n 's/^.*Type: \(.*\).*$/\1/p'`
echo "type=$type"
type=Bilevel
alpha=`convert ce82e79268.png -format "%A" info:`
echo "withAlpha=$alpha"
withAlpha=True
NOTE: your histogram says the image is totally black, but has an 8-bit alpha.
NOTE2: Perhaps your other software is only looking at the image in gross terms or only looking at the colorspace, so only distinguishing between RGB and CMYK. Without working with your other software, it is hard to tell what it is doing!
NOTE3: Both images are totally black with 8-bit transparency. The only difference is that the first is truecolor and the second is pseudocolor. That may be why your other software thinks one is RGB (for truecolor) and thinks the other is grayscale (for pseudocolor). Truecolor is 24-bit total RGB (8-bits per each r,g,b channel) and pseudocolor is 8-bit total RGB. But in fact, your image has only one color - black (so bilevel, but no white) with 8-bit alpha.