Hello all:
I have been looking around, and not really finding the right answer yet.
I have PNG's that are being dynamically created every hour, and they are coming out as 64-bit PNG's.
They do have transparencies in them, as part of the image creation, right now I do not need the transparencies in the final output of image (though maybe in the future).
So I want to output the final composition as a 24-bit PNG. Or as a 32-bit PNG (24-bit plus 8-bit alpha) for future use.
Any help in how to output in these formats using Perl would be greatly appreciated.
Thanks!
John
Setting PNG output to 24-bit color
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Setting PNG output to 24-bit color
In command line you can use -depth 8 to make the output 32bit rather than 64bit. You can get rid of transparency by adding -alpha off or +matte. Also see
http://www.imagemagick.org/script/comma ... .php#depth
http://www.imagemagick.org/script/comma ... .php#alpha
http://www.imagemagick.org/Usage/masking/#alpha
http://www.imagemagick.org/Usage/formats/#png
Sorry I do not know the equivalent in Perlmagick, but see alpha and matte image attributes and depth attribute at
http://www.imagemagick.org/script/perl-magick.php
http://www.imagemagick.org/script/comma ... .php#depth
http://www.imagemagick.org/script/comma ... .php#alpha
http://www.imagemagick.org/Usage/masking/#alpha
http://www.imagemagick.org/Usage/formats/#png
Sorry I do not know the equivalent in Perlmagick, but see alpha and matte image attributes and depth attribute at
http://www.imagemagick.org/script/perl-magick.php
Re: Setting PNG output to 24-bit color
Ok, after much searching, I found it.
You add png24: before the filename:
John
You add png24: before the filename:
Code: Select all
$image->Write(filename => "png24:sample.png");