Set Alpha to 1 bit

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
libin_v

Set Alpha to 1 bit

Post by libin_v »

Hi all,

I have an image with the following properties
Format: PNG (Portable Network Graphics)
Class: DirectClass
Type: TrueColorMatte
Colorspace: RGB
Depth: 8-bit
Channel depth:
Red: 8-bit
Green: 8-bit
Blue: 8-bit
Alpha: 8-bit

I want to change the same to the following, ie with Alpha Channel Depth as 1. (I believe, this is what happens when switch from RGB to Indexed in GIMP)
Format: PNG (Portable Network Graphics)
Class: PseudoClass
Type: PaletteMatte
Colorspace: RGB
Depth: 8-bit
Channel depth:
Red: 8-bit
Green: 8-bit
Blue: 8-bit
Alpha: 1-bit

I tried the "convert in.png -type PaletteMatte -channel Alpha -depth 1 out.png", this did set the Alpha Channel Depth to 1, but also made the image greyscale.

Also tried "convert in.png -type PaletteMatte -channel RGB -depth 8 -channel Alpha -depth 1 out.png" in vain to achieve the same result as above.

Please help me.
--
Regards,
Libin Varghese
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Set Alpha to 1 bit

Post by magick »

Try PNG8, for example,

convert image.tif png8:image.png
libin_v

Re: Set Alpha to 1 bit

Post by libin_v »

Thanks for the quick reply.

I tried convert in.png png8:out.png

When I do identify, I get
Type: GreyScaleMatte
Colorscale: GreyScale
Yes, alpha channel depth has become 1. but I don't want gray scale. I want to maintain the RGB

--
Regards,
Libin Varghese
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Set Alpha to 1 bit

Post by anthony »

To force RGB try...

convert in.png -type TrueColorMatte png8:out.png

PNG8 in IM forces GIF like boolean transparency, while TruecolorMatte setting
should force RGB for the other parts.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply