Jump to content

cbox


Recommended Posts

Posted

I need some help with image editing in PHP.

 

Their are three parts of the image editing I need help with.

 

Going from

http://cvcl.mit.edu/hybrid/cat2.jpg

to

post-1718-124570085144_thumb.png

(adding text)

 

 

from

http://cvcl.mit.edu/hybrid/cat2.jpg

to

post-1718-124570087964_thumb.png

(adding another image)

 

 

from

http://cvcl.mit.edu/hybrid/cat2.jpg

to

post-1718-124570090354_thumb.png

(inverting or changing colors)

 

Thanks for any help in advance.

Posted

ImageString($image, 1, $x, $y, 'Text', $text_color);

Send it the image in that var, and give it the x and y coordinates of the string, and make a variable to the color and thats text_color

 

 

 

//Image on top
$overlay = 'gamerpic.php';
//Background
$image = imagecreatefrompng('kjigd3.png');
//Image on top
$oimg = imagecreatefrompng($overlay)
//Output
imagettftext($oimg, 20, 0, ($img_w/2 - $pos_activity[2]), 50);

 

This will put one image on top (take from google, could be wrong)

 

 

Inverting is directly from the php manual here.

 

<?php
header("Content-Type: image/jpeg");

$image = imagecreatefromjpeg("flower_normal.jpg");
$image_width = imagesx($image);
$image_height = imagesy($image);

for ($h = 0; $h < $image_height; $h++) {
   for ($w = 0; $w < $image_width; $w++) {
       $colors = imagecolorsforindex($image, imagecolorat($image, $w, $h));
       $colors['red'] = 255 - $colors['red'];
       $colors['green'] = 255 - $colors['green'];
       $colors['blue'] = 255 - $colors['blue'];
       $new_color = imagecolorallocate($image, $colors['red'], $colors['green'], $colors['blue']);
       imagesetpixel($image, $w, $h, $new_color);
   }
}

imagejpeg($image, NULL, 80);
?>

  • Like 1

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...