note 114337 added to imagick.flattenimages

From: Date: Mon, 10 Feb 2014 11:15:13 +0000
Subject: note 114337 added to imagick.flattenimages
Groups: php.notes 
Request: Send a blank email to php-notes+get-198445@lists.php.net to get a copy of this message
Small correction to Jairu5's code: If you want to set the background color of a transparent image you have to set it _before_ loading the image. Flattening images by default uses the background color 'white'. That's why Jairu5's code seem to work at first, but only until you want to actually change the background color to something different than white. Try using this instead: <?php $im = new Imagick(); $im->setImageBackgroundColor('green'); $im->readimage('image.png'); $im = $im->flattenImages(); $im->setImageFormat('jpg'); $im->writeImage('image.jpg'); ?> ---- Server IP: 72.52.91.14 Probable Submitter: 72.52.91.14 ---- Manual Page -- http://php.net/manual/en/imagick.flattenimages.php Edit -- https://master.php.net/note/edit/114337 Del: integrated -- https://master.php.net/note/delete/114337/integrated Del: useless -- https://master.php.net/note/delete/114337/useless Del: bad code -- https://master.php.net/note/delete/114337/bad+code Del: spam -- https://master.php.net/note/delete/114337/spam Del: non-english -- https://master.php.net/note/delete/114337/non-english Del: in docs -- https://master.php.net/note/delete/114337/in+docs Del: other reasons-- https://master.php.net/note/delete/114337 Reject -- https://master.php.net/note/reject/114337 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#198445) next »