potential bug in txt- reporting alpha for psd IM 6.4.1-8

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

potential bug in txt- reporting alpha for psd IM 6.4.1-8

Post by fmw42 »

When using txt:- to report the channels of an image, I am getting a problem with cmyka for psd format images.

Tests as follows:

Create the following in IM:

convert rose: rose_rgb.tif
convert rose_rgb.tif[1x1+0+0] txt:-
# ImageMagick pixel enumeration: 1,1,255,rgb
0,0: ( 48, 47, 45) #302F2D rgb(48,47,45)
works fine

convert rose: rose_rgb.psd
rose_rgb.psd[1x1+0+0] txt:-
# ImageMagick pixel enumeration: 1,1,255,rgb
0,0: ( 48, 47, 45) #302F2D rgb(48,47,45)
works fine

convert rose_rgb.tif -matte rose_rgba.tif
convert rose_rgba.tif[1x1+0+0] txt:-
# ImageMagick pixel enumeration: 1,1,255,rgba
0,0: ( 48, 47, 45, 0) #302F2D rgb(48,47,45)
works fine

convert rose_rgb.psd -matte rose_rgba.psd
convert rose_rgba.psd[1x1+0+0] txt:-
# ImageMagick pixel enumeration: 1,1,255,rgb
0,0: ( 0,255,255) #00FFFF cyan

# ImageMagick pixel enumeration: 1,1,255,rgb
0,0: ( 54, 51, 45, 0) #36332D rgb(54,51,45)
incorrect first set of data and correct 4-channel color values in second, but reported as rgb not rgba

But verbose info shows there is an alpha


Create CMYK in another application (GraphicConverter or Photoshop):
rose_cmyk.tif
rose_cmyk.psd

In IM add alpha:
convert rose_cmyk.tif -matte rose_cmyka.tif
convert rose_cmyka.tif[1x1+0+0] txt:-
# ImageMagick pixel enumeration: 1,1,255,cmyka
0,0: (197,187,184,113, 0) #C5BBB871 cmyk(197,187,184,113)
works fine

convert rose_cmyk.psd -matte rose_cmyka.psd
convert rose_cmyka.psd[1x1+0+0] txt:-
# ImageMagick pixel enumeration: 1,1,255,cmyk
0,0: (255, 0, 0,255) #FF0000FF red

# ImageMagick pixel enumeration: 1,1,255,cmyk
0,0: (186,177,182,115, 0) #BAB1B673 cmyk(186,177,182,115)
incorrect first set of data and correct 4-channel color values in second, but reported as rgb not rgba


So tif gets alpha reported correctly for both rgba and cmyka but psd does not. ( I also checked rgba png and that works fine)


Is this a bug with psd and alpha in IM?

The reason that this is important, is that I have a script that tries to extract what channels are in an image. It used a combination of colorspace (to get grayscale) and txt:- as above to determine if any of the following channels exist in an image: gray, rgb, rgba, cmyk, cmyka.

Any chance a new string format %[channels] could be made in the future to report this kind of information?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: potential bug in txt- reporting alpha for psd IM 6.4.1-8

Post by magick »

The TXT format problem is fixed. We'll add %[channel] by tomorrow.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: potential bug in txt- reporting alpha for psd IM 6.4.1-8

Post by fmw42 »

Terrific!

Thanks

I forgot one other channel choice: graya. I would suggest that "%[channel] have at least options:

gray
graya
rgb
rgba
cmyk
cmyka

But I am not sure how you want to identify gray and graya -- is one letter for gray possible (unfortunately g is already green). Can you have things like rg, rb, gb with or without a? I am not sure what the best way to report a list of channels might be and what all the possible combinations might be. I will leave that to you or you can let me know and we can discuss if you want.

Fred

P.S. See my post about -displace if you have not already.
Post Reply