K
K
KoRNeT46RuS2016-06-14 16:29:54
PHP
KoRNeT46RuS, 2016-06-14 16:29:54

When resizing an image with a transparent background using the Imagick class, images with a black background appear. How to fix?

I am resizing a png image with a transparent background in several copies in jpg format. The transparent background is painted black. How to make it white?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Minisol, 2016-06-14
@KoRNeT46RuS

try like this:

$white=new Imagick();
$white->newImage($width, $height, "white");
$white->compositeimage($image, Imagick::COMPOSITE_OVER, 0, 0);
$white->setImageFormat('jpg');
$white->writeImage('image.jpg');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question