Convert to grayscale , keep transparency

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
mdibango

Convert to grayscale , keep transparency

Post by mdibango »

Hi ,

My problem is that i don't see how to convert a png image with a transparent background and keeping it transparent.
With

Code: Select all

convert -type Grayscale "picture.png" "picture_nb.png"

transparency become black background.

If anyone can help.

Thank you
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Convert to grayscale , keep transparency

Post by fmw42 »

here is an example

create color image with transparent background

convert logo: -transparent white logot.png

change to gray with transparent background

convert logot.png -colorspace gray logotg.png

or

convert logot.png -channel RGBA -matte -colorspace gray logotg.png
mdibango

Re: Convert to grayscale , keep transparency

Post by mdibango »

It's working

thanks a lot
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Convert to grayscale , keep transparency

Post by anthony »

Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply