diff --git a/Imager.pm b/Imager.pm index bde1f2a3..88668a8f 100644 --- a/Imager.pm +++ b/Imager.pm @@ -4581,6 +4581,9 @@ text, measuring - L, L tiles, color - L +transparent images - L, +L + =for stopwords unsharp unsharp mask - L diff --git a/lib/Imager/Cookbook.pod b/lib/Imager/Cookbook.pod index cb1c4ffc..0724ec02 100644 --- a/lib/Imager/Cookbook.pod +++ b/lib/Imager/Cookbook.pod @@ -91,6 +91,25 @@ say TIFF to JPEG, you'll need multiple output files: or die $image->errstr; } +=head2 Transparent PNG + +To save to a transparent PNG (or GIF or TIFF) you need to start with +an image with transparency. + +To make a transparent image, create an image object with 2 or 4 +channels: + + # RGB with alpha channel + my $rgba = Imager->new(xsize => $width, ysize => $height, channels => 4); + + # Gray with alpha channel + my $graya = Imager->new(xsize => $width, ysize => $height, channels => 2); + +By default, the created image will be transparent. + +Otherwise, if you have an existing image file with transparency, +simply read it, and the transparency will be preserved. + =head1 IMAGE SYNTHESIS =head2 Creating an image diff --git a/lib/Imager/ImageTypes.pod b/lib/Imager/ImageTypes.pod index 9e964967..fbc8c4c4 100644 --- a/lib/Imager/ImageTypes.pod +++ b/lib/Imager/ImageTypes.pod @@ -102,7 +102,8 @@ stored. Imager treats these as follows: =item * -2 samples per color - gray scale image with alpha channel. +2 samples per color - gray scale image with alpha channel, allowing +transparency. =item * @@ -110,7 +111,8 @@ stored. Imager treats these as follows: =item * -4 samples per color - RGB image with alpha channel. +4 samples per color - RGB image with alpha channel, allowing +transparency. =back