Closed Eugene-nsk closed 3 years ago
It's probably best to create a new image with the desired background and overlay the PNG onto it. Untested, but something like this should do it:
$image = new SimpleImage();
$image->fromFile('image.png');
$canvas = new SimpleImage();
$canvas
->fromNew($image->getWidth(), $image->getHeight(), '#ffffff')
->overlay($image)
->toScreen('image/jpeg');
When I insert this code
->fromFile('file.png')->toScreen('image/jpeg');
transparent parts of PNG image go to black.How can I change fill color to white or another?