Re: Imagick question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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();


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux