]> git.imager.perl.org - imager.git/commitdiff
make finding out how to make a transparent image simpler
authorTony Cook <tony@develop=help.com>
Mon, 6 Dec 2010 10:46:20 +0000 (10:46 +0000)
committerTony Cook <tony@develop=help.com>
Mon, 6 Dec 2010 10:46:20 +0000 (10:46 +0000)
Imager.pm
lib/Imager/Cookbook.pod
lib/Imager/ImageTypes.pod

index bde1f2a31ec754efabd1d1a0961d414f5462663b..88668a8fc4fca17fdc87ac10b40739fa5c780058 100644 (file)
--- a/Imager.pm
+++ b/Imager.pm
@@ -4581,6 +4581,9 @@ text, measuring - L<Imager::Font/bounding_box>, L<Imager::Font::BBox>
 
 tiles, color - L<Imager::Filters/mosaic>
 
+transparent images - L<Imager::ImageTypes>,
+L<Imager::Cookbook/"Transparent PNG">
+
 =for stopwords unsharp
 
 unsharp mask - L<Imager::Filters/unsharpmask>
index cb1c4ffcdbbe75ea1119dc820dbdcf49404ede3f..0724ec02fa4e9d6bfd9c8d2390554fe042bf90ed 100644 (file)
@@ -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
index 9e964967c8c83bd7a043108b247060333010e5d7..fbc8c4c4f93792ae73f3d6a1a6a515457c91b238 100644 (file)
@@ -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