开发者

Is it possible to apply color effects to an image? [closed]

开发者 https://www.devze.com 2023-04-10 02:20 出处:网络
Closed. This question needs to be more focused. It is not currently accepting answers. 开发者_JAVA百科
Closed. This question needs to be more focused. It is not currently accepting answers.
开发者_JAVA百科

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

Closed 6 years ago.

Improve this question

any one guide me is it possible to apply color effects to an image using php?

as mentioned in the screen shot i want to select Ice,Black,Crystal etc.. color effect from the top and it should be applied to image selected below?

Is it possible to apply color effects to an image? [closed]

or any useful solution?

any help would be appreciated.


There is the GD library in PHP which I used successfully some time ago.


I'd highly recommend installing imagemagick on your server and then installing the imagick PHP extension. Imagemagick is extremely powerful and basically functions like a command-line Photoshop.


This function takes an image, then lets you add red, green, or blue to the image. You can also use negative numbers when calling this function, to create a lack of color.

function shade($image,$r=0,$g=0,$b=0){
$width=imagesx($image);
$height=imagesy($image);
$aw=0;
$ah=0;
for(;;){
if ($aw==$width) {$aw=0; $ah++;}
if ($ah==$height) break;
$rgb = imagecolorat($image, $aw, $ah);
$colors = imagecolorsforindex($image, $rgb);
$ar = $colors['red'];
$ag = $colors['green'];
$ab = $colors['blue'];
$ar+=$r;
$ag+=$g;
$ab+=$b;
if ($ar>255) $ar=255;
if ($ag>255) $ag=255;
if ($ab>255) $ab=255;
if ($ar<0) $ar=0;
if ($ag<0) $ag=0;
if ($ab<0) $ab=0;
$newcolor = imagecolorallocate($image, $ar, $ag, $ab);
$black = imagecolorallocate($image, 0, 55, 0);
imagesetpixel ($image , $aw , $ah , $newcolor );
$aw++;
}//end loop
return $image;
}


You should check out pslayers it will enable you to do what you're wanting to do.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号