note 89985 rejected from function.imagick-getimagedepth by danbrown
| From: | danbrown@php.net | Date: | Wed, 01 Apr 2009 04:02:07 +0000 |
| Subject: | note 89985 rejected from function.imagick-getimagedepth by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-152678@lists.php.net to get a copy of this message | ||
Note Submitter: fworsley at gmail dot com
----
I'm having a problem with this method on Ubuntu Hardy. The Imagick extension on this platform
is compiled using QuantumDepth 16.
Whenever I open an 8-bit per-channel PNG image and modify it, it is then resaved as 16-bit
per-channel. This increases the size of a previously 130kb PNG to now over 400kb.
Calling setImageDepth(8) does not have any effect. I've also tried using
setImageChannelDepth(Imagic::CHANNEL_ALL, 8) and it doesn't work either.
Am I doing something wrong? How can I get the saved image to only have an 8-bit per-channel depth?
On the command line running "convert original.png -depth 8 new.png" works fine.
ImageMagick on the command line is also compiled with QuantumDepth 16.
For example:
$im = new Imagick('image.png');
$im->scaleImage(100, 100);
$im->setImageDepth(8);
$im->writeImage('image.png');
After this code image.png will have 16-bit per-channel and a much larger file size.