Converting multi color image to a single color

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
hiemanshu
Posts: 8
Joined: 2016-05-25T10:57:16-07:00
Authentication code: 1151

Converting multi color image to a single color

Post by hiemanshu »

I'm trying to convert a multi color image into a single color image. I've tried converting it first to grayscale and then tinting, and also tried using fred's colorfilter script. It works well for a lot of cases but in some cases I end up losing details.

For example I use this image:

Image

I first convert it to grayscale, and then use colorfilter. I get something like:

Image

I've lost some detail at the bottom. I want to end up getting something like:

Image

The hex code for the red color is #960032
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Converting multi color image to a single color

Post by fmw42 »

Try

Code: Select all

convert 0Z3wSND.jpg -fuzz 5% -fill white -opaque "#ECE5D3" -colorspace gray +level-colors "#960032,white" result.png
Adjust the fuzz value as desired.
hiemanshu
Posts: 8
Joined: 2016-05-25T10:57:16-07:00
Authentication code: 1151

Re: Converting multi color image to a single color

Post by hiemanshu »

Thanks, this worked really well!
Post Reply