Imagick set background colour

Posted on 2011-10-10
Last Modified: 2012-05-12
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->setImageBackgroundColor(new ImagickPixel('white')); 
		$thumb_img->writeImage($folder . 'thumb_' . $destination);			

Open in new window

Question by:SheppardDigital
    1 Comment
    LVL 7

    Accepted Solution

    You could draw a white rectangle to fill the whole destination image ...

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    Suggested Solutions

    A colleague recently asked me about how to give his client a small part of the web site that could be completely under the client's control.  Since I have done this sort of thing before to add emergency banners to a web site, I decided I would creat…
    Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
    The viewer will learn how to count occurrences of each item in an array.
    This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now