-C<$img-E<gt>read()> generally takes two parameters, 'file' and 'type'.
-If the type of the file can be determined from the suffix of the file
-it can be omitted. Format dependant parameters are: For images of
-type 'raw' two extra parameters are needed 'xsize' and 'ysize', if the
-'channel' parameter is omitted for type 'raw' it is assumed to be 3.
-gif and png images might have a palette are converted to truecolor bit
-when read. Alpha channel is preserved for png images irregardless of
-them being in RGB or gray colorspace. Similarly grayscale jpegs are
-one channel images after reading them. For jpeg images the iptc
-header information (stored in the APP13 header) is avaliable to some
-degree. You can get the raw header with C<$img-E<gt>{IPTCRAW}>, but
-you can also retrieve the most basic information with
-C<%hsh=$img-E<gt>parseiptc()> as always patches are welcome. pnm has no
-extra options. Examples:
-
- $img = Imager->new();
- $img->read(file=>"cover.jpg") or die $img->errstr; # gets type from name
-
- $img = Imager->new();
- { local(*FH,$/); open(FH,"file.gif") or die $!; $a=<FH>; }
- $img->read(data=>$a,type=>'gif') or die $img->errstr;
-
-The second example shows how to read an image from a scalar, this is
-usefull if your data originates from somewhere else than a filesystem
-such as a database over a DBI connection.
-
-When writing to a tiff image file you can also specify the 'class'
-parameter, which can currently take a single value, "fax". If class
-is set to fax then a tiff image which should be suitable for faxing
-will be written. For the best results start with a grayscale image.
-By default the image is written at fine resolution you can override
-this by setting the "fax_fine" parameter to 0.
-
-If you are reading from a gif image file, you can supply a 'colors'
-parameter which must be a reference to a scalar. The referenced
-scalar will receive an array reference which contains the colors, each
-represented as an Imager::Color object.
-
-If you already have an open file handle, for example a socket or a
-pipe, you can specify the 'fd' parameter instead of supplying a
-filename. Please be aware that you need to use fileno() to retrieve
-the file descriptor for the file:
-
- $img->read(fd=>fileno(FILE), type=>'gif') or die $img->errstr;
-
-For writing using the 'fd' option you will probably want to set $| for
-that descriptor, since the writes to the file descriptor bypass Perl's
-(or the C libraries) buffering. Setting $| should avoid out of order
-output. For example a common idiom when writing a CGI script is:
-
- # the $| _must_ come before you send the content-type
- $| = 1;
- print "Content-Type: image/jpeg\n\n";
- $img->write(fd=>fileno(STDOUT), type=>'jpeg') or die $img->errstr;
-
-*Note that load() is now an alias for read but will be removed later*
-
-C<$img-E<gt>write> has the same interface as C<read()>. The earlier
-comments on C<read()> for autodetecting filetypes apply. For jpegs
-quality can be adjusted via the 'jpegquality' parameter (0-100). The
-number of colorplanes in gifs are set with 'gifplanes' and should be
-between 1 (2 color) and 8 (256 colors). It is also possible to choose
-between two quantizing methods with the parameter 'gifquant'. If set
-to mc it uses the mediancut algorithm from either giflibrary. If set
-to lm it uses a local means algorithm. It is then possible to give
-some extra settings. lmdither is the dither deviation amount in pixels
-(manhattan distance). lmfixed can be an array ref who holds an array
-of Imager::Color objects. Note that the local means algorithm needs
-much more cpu time but also gives considerable better results than the
-median cut algorithm.
-
-When storing targa images rle compression can be activated with the
-'compress' parameter, the 'idstring' parameter can be used to set the
-targa comment field and the 'wierdpack' option can be used to use the
-15 and 16 bit targa formats for rgb and rgba data. The 15 bit format
-has 5 of each red, green and blue. The 16 bit format in addition
-allows 1 bit of alpha. The most significant bits are used for each
-channel.
-
-Currently just for gif files, you can specify various options for the
-conversion from Imager's internal RGB format to the target's indexed
-file format. If you set the gifquant option to 'gen', you can use the
-options specified under L<Quantization options>.
-
-To see what Imager is compiled to support the following code snippet
-is sufficient:
-
- use Imager;
- print "@{[keys %Imager::formats]}";
-
-When reading raw images you need to supply the width and height of the
-image in the xsize and ysize options:
-
- $img->read(file=>'foo.raw', xsize=>100, ysize=>100)
- or die "Cannot read raw image\n";
-
-If your input file has more channels than you want, or (as is common),
-junk in the fourth channel, you can use the datachannels and
-storechannels options to control the number of channels in your input
-file and the resulting channels in your image. For example, if your
-input image uses 32-bits per pixel with red, green, blue and junk
-values for each pixel you could do:
-
- $img->read(file=>'foo.raw', xsize=>100, ysize=>100, datachannels=>4,
- storechannels=>3)
- or die "Cannot read raw image\n";
-
-Normally the raw image is expected to have the value for channel 1
-immediately following channel 0 and channel 2 immediately following
-channel 1 for each pixel. If your input image has all the channel 0
-values for the first line of the image, followed by all the channel 1
-values for the first line and so on, you can use the interleave option:
-
- $img->read(file=>'foo.raw', xsize=100, ysize=>100, interleave=>1)
- or die "Cannot read raw image\n";
-
-=head2 Multi-image files
-
-Currently just for gif files, you can create files that contain more
-than one image.
-
-To do this:
-
- Imager->write_multi(\%opts, @images)
-
-Where %opts describes 4 possible types of outputs:
-
-=over 5
-
-=item type