I've got a black logo, that's being colored using the following code
/**
* Adds the logo to the image, and colours it if the colour isnt black
*/
public function addLogo($color = 'FFFFFF'){
// Future note: The logo has to be black to have it's colour changed. White logo's don't work.
$logoImage = imagecreatefrompng(APPLICATION_PATH . '/../public_html/images/widget/overlay/JSLogo2.png');
// If a hex is passed, and it's not black, colour the logo.
if($color != null && $color != '000000'){
imagefilter($logoImage, IMG_FILTER_COLORIZE, hexdec('0x' . $color{0} . $color{1}), hexdec('0x' . $color{2} . $color{3}), hexdec('0x' . $color{4} . $color{5}));
}
// Get the offset.
$offset = $this->getPadding() + $this->_circleWidth + (5 * $this->_scaleFactor);
imagecopyresampled(
$this->getImage(),
$logoImage,
$offset,
($this->_scaleFactor * $this->_padding),
0,
0,
$this->_logoWidth,
$this->_logoHeight,
$this->_oriLogoWidth,
$this->_oriLogoHeight
);
imagedestroy($logoImage);
return $this;
}
The output colours most of the image, but leaves the edges. Is there anyway I can improved the coverage of the colour, or is this the best that PHP will be able to do? Below is a screenshot of the output. The same effect happens on any logo colour and background colour.