0
我想了解PHP中的图像操作并编写一些代码来编辑照片。用GD改变图像颜色
所以,我正在阅读关于imagefilter()函数,但我想手动编辑collors。
我有一小片与ImageFilter的代码做一个形象深褐色
imagefilter($image, IMG_FILTER_GRAYSCALE);
imagefilter($image, IMG_FILTER_COLORIZE, 55, 25, -10);
imagefilter($image, IMG_FILTER_CONTRAST, -10);
我想这样做,但没有ImageFilter中的();有可能的?
我明白它可能会获取图像中的颜色,然后更改它们并重新绘制它;
为了让图像色彩我有这样的:
$rgb = imagecolorat($out, 10, 15);
$colors = imagecolorsforindex($out, $rgb);
而这种打印:
array(4) {
["red"]=> int(150)
["green"]=> int(100)
["blue"]=> int(15)
["alpha"]=> int(0)
}
,我可以编辑这些值,并将其融入图片?
我将不胜感激任何形式的帮助:书籍,教程,代码片断。
不起作用! – 2013-03-21 07:38:24
我测试了它,它适用于我,你是如何测试它的? – MarcDefiant 2013-03-21 07:43:26
$ image = imagecreatefromjpeg($ _ photo); $ rgb = imagecolorat($ image,10,15); $ colors = imagecolorsforindex($ image,$ rgb); var_dump($ colors); (color)['red']/4,$ colors ['green']/4,$ colors ['blue']/4); $ color = ['blue']/4); imagesetpixel($ image,10,15,$ new_color); imagejpeg($ image,'grayscale-sun.jpg'); imagedestroy($ image); echo''; – 2013-03-21 07:45:30