Avatar of SheppardDigital
SheppardDigital

asked on 

Imagick set background colour

I've try to use imagick to convert a JPG to PNG, but I need to apply a white background so that the png doesn't remain transparent.

I can't seem to figure it out.

I've attached the code I've got so far.
$thumb_img->thumbnailImage($newthumbwidth,$newthumbheight);
		$thumb_img->setImageBackgroundColor(new ImagickPixel('white')); 
		$thumb_img->setImageColorspace(Imagick::COLORSPACE_SRGB);
		$thumb_img->setImageFormat("jpeg");		
		$thumb_img->writeImage($folder . 'thumb_' . $destination);			
		$thumb_img->destroy();

Open in new window

PHP

Avatar of undefined
Last Comment
ziceva

8/22/2022 - Mon