Color Overlay

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
riegel
Posts: 26
Joined: 2003-08-19T12:36:46-07:00
Location: Rocky Mount, NC 27804

Color Overlay

Post by riegel »

Does anyone know how to duplicate the "Color Overlay" feature in photoshop. Basically it replaces all pixels with a specific color.

Thanks for any help

Terry Riegel
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

To replace all pixels in an image with a specific color, use this command:
  • convert image.jpg -fill red -draw 'color 0,0 reset' image.png
riegel
Posts: 26
Joined: 2003-08-19T12:36:46-07:00
Location: Rocky Mount, NC 27804

Post by riegel »

That replaces the transparent areas also, I just want to replace any pixel that has a color similar to Photoshops "Color Overlay" command
riegel
Posts: 26
Joined: 2003-08-19T12:36:46-07:00
Location: Rocky Mount, NC 27804

Post by riegel »

magick wrote: To replace all pixels in an image with a specific color, use this command:
  • convert image.jpg -fill red -draw 'color 0,0 reset' image.png


The above command has the effect of creating a red box of the same dimensions as the original graphic. I am looking for something that will replace all exisitng pixels with red. In other words I don't want red in the transparent areas.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Post by magick »

Ok, try this:
  • convert image.jpg \( -clone 0 -fill red -draw "color 0,0 reset" \) -compose atop -composite image.png
This command will only work with a modern version of ImageMagick. If this is still not what you want, let us know.
riegel
Posts: 26
Joined: 2003-08-19T12:36:46-07:00
Location: Rocky Mount, NC 27804

Post by riegel »

magick wrote: convert image.jpg \( -clone 0 -fill red -draw "color 0,0 reset" \) -compose atop -composite image.png


Thanks, it works awesome.
xcart
Posts: 1
Joined: 2012-04-25T01:00:21-07:00
Authentication code: 13

Re: Color Overlay

Post by xcart »

It does not work for me. Is it working with current ImageMagick version 6.7.6?

It generated red square and fill background too but transparent background should be kept.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Color Overlay

Post by anthony »

Instead of 'reset' you should be using 'replace' or all of that color (like -opaque operator) or 'floodfill' to replace colors next to the seed point.

See Color replacement
http://www.imagemagick.org/Usage/color_basics/#replace

And Draw Color primative
http://www.imagemagick.org/Usage/draw/#color
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply