• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 531
  • Last Modified:

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

0
SheppardDigital
Asked:
SheppardDigital
1 Solution
 
zicevaCommented:
You could draw a white rectangle to fill the whole destination image ...

http://www.php.net/manual/en/function.imagickdraw-rectangle.php
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now