Re: Imagick question

From: Date: Fri, 06 Nov 2009 20:32:37 +0000
Subject: Re: Imagick question
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-299689@lists.php.net to get a copy of this message
I think to do this effectively, you'll need to create two images, as such (adapting from your code): <?php $width = 150; $height = 150; $background = 'white'; $im = new Imagick(); $im->newImage($width, $height, $background); $thumb = new Imagick('original/' . $filename); $thumb->thumbnailImage($width, $height, true); $thumb->sharpenImage(50, 1); $thumb->roundCorners(5, 5, 7); $im->compositeImage($thumb, Imagick::COMPOSITE_OVER, 0, 0); $im->setImageFormat('jpeg'); $im->flattenImages(); $im->writeImage('thumbnail/' . $filename); /* Or display directly to screen header("Content-Type: image/jpeg"); echo $im; */ $im->clear(); $im->destroy(); $cv->clear(); $cv->destroy(); ?> That seems to be the only way I can find to control which colors are used. -Jason Ashley M. Kirchner wrote:
Ashley Sheridan wrote:
Fill the background with white before you create the corners.
Well, I tried that, with no luck. This is my actual code:
     $width = 150;
     $height = 150;
     $im = new Imagick('original/' . $filename);
     $im->thumbnailImage($width, $height, true);
     $im->sharpenImage(50, 1);
     $im->setImageBackgroundColor('white');
     $im->roundCorners(5, 5, 7);
     $im->setImageFormat('jpeg');
     $im->writeImage('thumbnail/' . $filename);
     $im->clear();
     $im->destroy();


« previous php.general (#299689) next »