problem in changing color

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
ratneshsoni
Posts: 38
Joined: 2010-12-14T03:56:10-07:00
Authentication code: 8675308

problem in changing color

Post by ratneshsoni » 2011-05-20T10:12:45-07:00

Hello
i also ask the solution of this in my previous post, but i dont get to it now i am making it fresh. in below there is two image one is original and another is color changed.
Image

in above image u see that original is clear but when i change the color of image it not clear it sumthing become jaggy.

i am using following command change the color. In this first i change the image color into gray and then change into requested color.

exec("convert newimage.gif -colorspace Gray images/colorchg/new_gray.gif");
exec("convert images/colorchg/new_gray.gif -fill '#ff0000' -tint 200 images/colorchg/newclr.gif");
it also happen sumtime that when i resize the image then also this happen.
please tell the me prefect solution for changing the color of its urgent.

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

Re: problem in changing color

Post by fmw42 » 2011-05-20T10:50:49-07:00

I don't think there is a perfect solution. When you resize and/or have anti-aliased pixels, then the recoloring affects the anti-aliased pixels part one way and part the other way. Thus the aliasing returns.

try

convert image -colorspace gray +level-colors somecolor,white newimage.gif

or

convert image -colorspace gray +level-colors black,somecolor newimage.gif

or

convert image -colorspace gray -fuzz XX% -fill somecolor -opaque black newimage.gif

Post a link to your original image so others can try various potential solutions.

Post Reply