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.
Posts: 38
Joined: 2010-12-14T03:56:10-07:00
Authentication code: 8675308

problem in changing color

Post by ratneshsoni »

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.

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
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: problem in changing color

Post by fmw42 »

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.


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


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


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.