Renlok Posted January 16, 2008 Share Posted January 16, 2008 I'm trying to make a recolouring script, by layering multiple transparent layers and colouring some of them. But i cant get imagefilltoborder to work no matter what i try. It just fills up the entire image with the fill colour ignoring the edges. Heres the code <?php //coords $base_x = array(100); $base_y = array(100); $eyes_x = array(43, 20); $eyes_y = array(83, 81); $detail_x = array(20,24,28,39,34,39,48,44,57,56,95,91,98); $detail_y = array(70,60,67,64,58,51,47,41,41,32,125,141,163); //testing page header ("Content-type: image/png"); $dogoverlay = imagecreatefrompng("images/misk-junk/dog-over.png"); imagealphablending($dogoverlay, true); imagesavealpha($dogoverlay, true); $dogbase = imagecreatefrompng("images/misk-junk/dog-base.png"); imagealphablending($dogbase, true); imagesavealpha($dogbase, true); $dogeyes = imagecreatefrompng("images/misk-junk/dog-eyes.png"); imagealphablending($dogeyes, true); imagesavealpha($dogeyes, true); $dogdetails = imagecreatefrompng("images/misk-junk/dog-detail.png"); imagealphablending($dogdetails, true); imagesavealpha($dogdetails, true); //get random colours to test with $newcolour1 = imagecolorallocate($dogbase, 56, 160, 156); $newcolour2 = imagecolorallocate($dogeyes, 253, 175, 4); $newcolour3 = imagecolorallocate($dogeyes, 50, 207, 70); $border = imagecolorallocate($dogbase, 50, 50, 50); //recolour base imagefilltoborder($dogbase, $base_x[0], $base_y[0], $border, $newcolour1); //recolour eyes for($i = 0; $i<count($eyes_x); $i++){ imagefilltoborder($dogeyes, $eyes_x[$i], $eyes_y[$i], $border, $newcolour2); } //recolour details for($i = 0; $i<count($detail_x); $i++){ imagefilltoborder($dogeyes, $detail_x[$i], $detail_y[$i], $border, $newcolour3); } imagecopymerge($dogeyes,$dogbase,0,0,0,0,$width,$height,100); imagecopymerge($dogdetails,$dogbase,0,0,0,0,$width,$height,100); imagecopymerge($dogoverlay,$dogbase,0,0,0,0,$width,$height,100); imagepng($dogbase,NULL,100); //clean up the image imagedestroy($dogbase); imagedestroy($dogoverlay); imagedestroy($dogeyes); imagedestroy($dogdetails); ?> And here are the images if that any help: http://www.roeonline.co.uk/images/misk-junk/dog-over.png http://www.roeonline.co.uk/images/misk-junk/dog-base.png http://www.roeonline.co.uk/images/misk-junk/dog-eyes.png http://www.roeonline.co.uk/images/misk-junk/dog-detail.png thanks in advance for any help ^^ Quote Link to comment https://forums.phpfreaks.com/topic/86374-help-with-imagefilltoborder/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.