JonnyT Posted July 2, 2009 Share Posted July 2, 2009 Hi. I currently have a script that removes the colour 'white' from an image. However, at the moment it only removes pure white. I was wondering if you guys could help me with allowing the script to also delete colours very similar to 255,255,255. Here is my script so far: <?php // Recieving the variables. $sims3user = $_POST['sims3user']; print $sims3user; // MAKE TRANSPARENT // Load image $img = imagecreatefromjpeg("http://www.thesims3.com/fetchAvatar/".$sims3user.""); // Make matte canvas $matte = imagecreatetruecolor(225,225); $trans_color = imagecolorallocatealpha($matte,255,255,255,0); imagefill($matte, 0,0,$trans_color); // Put the old image on the matte imagecopy($matte,$img,0,0,0,0,225,225); // Turn the matte color into full alpha (blended pixels will not be affected) imagecolortransparent($matte,$trans_color); // Display image header('Content-Type: image/png'); imagepng($matte, "/home/missings/public_html/ms/signaturegenerator/custom_sims/".$sims3user.".png"); ?> Link to comment https://forums.phpfreaks.com/topic/164538-gd-getting-similar-colours/ Share on other sites More sharing options...
JonnyT Posted July 2, 2009 Author Share Posted July 2, 2009 Is it possible to select all colours with R between 235-255 G between 235-255 B between 235-255 to carry out a function that makes them all 100% transparent? Link to comment https://forums.phpfreaks.com/topic/164538-gd-getting-similar-colours/#findComment-867965 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.