image color change with transparency (sample code inside)

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
Ravinderjit S.Sidhu

image color change with transparency (sample code inside)

Post by Ravinderjit S.Sidhu »

Code: Select all

convert    input.png    -fill #EAAB01 -opaque #000000  -colorize 100%   output.png

input.png file contains a single shape whose color is black (#000000).

The above statement changes this black color (#000000) into Yellow color (#EAAB01) of the image and we gets the new image in (output.png).

My question is : How I can get output image with yellow color (#EAAB01) with some transparency (alpha).
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: image color change with transparency (sample code inside)

Post by magick »

You can introduce transparency by adding alpha to your opaque color value (e.g. #000000cc). You may need the -matte option to tell ImageMagick you want an alpha channel in your image.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: image color change with transparency (sample code inside)

Post by anthony »

An example image can also help. For example is the shape anti-aliased or what. Usually a shape is defined as either a greyscale mask, or a colored shape on transparency, the example will let us know exactly what you are dealing with.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply