Change the color of an image in php?
How can i change the color of a clipart in a image ,this image 开发者_如何学Pythonhas red color heart in it http://www.tutorialpark.com/wp-content/uploads/3/Heart-Blending.jpg i want to change from red to blue in php Thanks. Mostly my images will be in png format.
In PHP5 you could use the imagefilter function with the filter, called "IMG_FILTER_COLORIZE". If you dont have PHP5 you could do it manually.
A user, called Bartman did the following solution, which works as far as I tested it: http://www.php.net/manual/en/function.imagecolorset.php#93134
To change the color of the image you can use imagefill() or imagefilltoborder (). Check this.
http://www.tuxradar.com/practicalphp/11/2/8
You can use my script if you have installed Imagick Library in your server. You can invoke it with:
./replacecolor -i "{what color shold be replaced}" -o "{to what color}" -f 40 -g 50 {path to img} {path to new image}
example:
精彩评论