Page 1 of 1

Setting PNG output to 24-bit color

Posted: 2012-10-19T15:38:52-07:00
by johnfl68
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.



Re: Setting PNG output to 24-bit color

Posted: 2012-10-19T16:10:23-07:00
by fmw42
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 ... .php#depth ... .php#alpha

Sorry I do not know the equivalent in Perlmagick, but see alpha and matte image attributes and depth attribute at

Re: Setting PNG output to 24-bit color

Posted: 2012-11-21T11:32:57-07:00
by johnfl68
Ok, after much searching, I found it.

You add png24: before the filename:

Code: Select all

$image->Write(filename => "png24:sample.png");