Jump to content

PHP-Image - Using GD in PHP (Help!)


refined

Recommended Posts

try

<?php
$im = imagecreatefromjpeg('gmc.jpg');


$white = imagecolorclosest($im, 255,255,255);
$black = imagecolorallocate($im, 0,0,0);
$sx = imagesx($im);
$sy = imagesy($im);
for ($x=0; $x<$sx; $x++)
{
    for ($y=0; $y<$sy; $y++)
    {
        $c = imagecolorat($im, $x, $y);
        if ($c != $white)
        {
            imagesetpixel($im, $x, $y, $black);
        }
    }
}
header("content-type:image/jpeg");
imagejpeg($im);
imagedestroy($im);
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.