]> git.imager.perl.org - imager.git/blobdiff - Imager.pm
quote a few hash keys to prevent warnings on 5.004
[imager.git] / Imager.pm
index 355c56be63c175f9a04b7d959f69d081c8de6a83..2b283a4fe6288f1c8f8992363aaa92c9b7d195fe 100644 (file)
--- a/Imager.pm
+++ b/Imager.pm
@@ -1,7 +1,7 @@
 package Imager;
 
 use strict;
-use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS %formats $DEBUG %filters %DSOs $ERRSTR $fontstate %OPCODES $I2P $FORMATGUESS);
+use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS %formats $DEBUG %filters %DSOs $ERRSTR $fontstate %OPCODES $I2P $FORMATGUESS $warn_obsolete);
 use IO::File;
 
 use Imager::Color;
@@ -147,7 +147,7 @@ BEGIN {
   require Exporter;
   require DynaLoader;
 
-  $VERSION = '0.39';
+  $VERSION = '0.40pre1';
   @ISA = qw(Exporter DynaLoader);
   bootstrap Imager $VERSION;
 }
@@ -363,6 +363,8 @@ BEGIN {
     };
 
   $FORMATGUESS=\&def_guess_type;
+
+  $warn_obsolete = 1;
 }
 
 #
@@ -385,12 +387,18 @@ sub init {
   if ($parms{'log'}) {
     init_log($parms{'log'},$parms{'loglevel'});
   }
+  if (exists $parms{'warn_obsolete'}) {
+    $warn_obsolete = $parms{'warn_obsolete'};
+  }
 
 #    if ($parms{T1LIB_CONFIG}) { $ENV{T1LIB_CONFIG}=$parms{T1LIB_CONFIG}; }
 #    if ( $ENV{T1LIB_CONFIG} and ( $fontstate eq 'missing conf' )) {
 #      i_init_fonts();
 #      $fontstate='ok';
 #    }
+  if (exists $parms{'t1log'}) {
+    i_init_fonts($parms{'t1log'});
+  }
 }
 
 END {
@@ -456,6 +464,11 @@ sub _error_as_msg {
 
 sub _color {
   my $arg = shift;
+  # perl 5.6.0 seems to do weird things to $arg if we don't make an 
+  # explicitly stringified copy
+  # I vaguely remember a bug on this on p5p, but couldn't find it
+  # through bugs.perl.org (I had trouble getting it to find any bugs)
+  my $copy = $arg . "";
   my $result;
 
   if (ref $arg) {
@@ -464,10 +477,10 @@ sub _color {
       $result = $arg;
     }
     else {
-      if ($arg =~ /^HASH\(/) {
+      if ($copy =~ /^HASH\(/) {
         $result = Imager::Color->new(%$arg);
       }
-      elsif ($arg =~ /^ARRAY\(/) {
+      elsif ($copy =~ /^ARRAY\(/) {
         if (grep $_ > 1, @$arg) {
           $result = Imager::Color->new(@$arg);
         }
@@ -854,6 +867,22 @@ sub deltag {
   }
 }
 
+sub settag {
+  my ($self, %opts) = @_;
+
+  if ($opts{name}) {
+    $self->deltag(name=>$opts{name});
+    return $self->addtag(name=>$opts{name}, value=>$opts{value});
+  }
+  elsif (defined $opts{code}) {
+    $self->deltag(code=>$opts{code});
+    return $self->addtag(code=>$opts{code}, value=>$opts{value});
+  }
+  else {
+    return undef;
+  }
+}
+
 my @needseekcb = qw/tiff/;
 my %needseekcb = map { $_, $_ } @needseekcb;
 
@@ -918,6 +947,11 @@ sub _get_writer_io {
       $self->_set_error("Handle in fh option not opened");
       return;
     }
+    # flush it
+    my $oldfh = select($input->{fh});
+    # flush anything that's buffered, and make sure anything else is flushed
+    $| = 1;
+    select($oldfh);
     return io_new_fd($fd);
   }
   elsif ($input->{file}) {
@@ -1162,6 +1196,94 @@ sub read {
   return $self;
 }
 
+sub _fix_gif_positions {
+  my ($opts, $opt, $msg, @imgs) = @_;
+  
+  my $positions = $opts->{'gif_positions'};
+  my $index = 0;
+  for my $pos (@$positions) {
+    my ($x, $y) = @$pos;
+    my $img = $imgs[$index++];
+    $img->settag(name=>'gif_left', value=>$x);
+    $img->settag(name=>'gif_top', value=>$y) if defined $y;
+  }
+  $$msg .= "replaced with the gif_left and gif_top tags";
+}
+
+my %obsolete_opts =
+  (
+   gif_each_palette=>'gif_local_map',
+   interlace       => 'gif_interlace',
+   gif_delays => 'gif_delay',
+   gif_positions => \&_fix_gif_positions,
+   gif_loop_count => 'gif_loop',
+  );
+
+sub _set_opts {
+  my ($self, $opts, $prefix, @imgs) = @_;
+
+  for my $opt (keys %$opts) {
+    my $tagname = $opt;
+    if ($obsolete_opts{$opt}) {
+      my $new = $obsolete_opts{$opt};
+      my $msg = "Obsolete option $opt ";
+      if (ref $new) {
+        $new->($opts, $opt, \$msg, @imgs);
+      }
+      else {
+        $msg .= "replaced with the $new tag ";
+        $tagname = $new;
+      }
+      $msg .= "line ".(caller(2))[2]." of file ".(caller(2))[1];
+      warn $msg if $warn_obsolete && $^W;
+    }
+    next unless $tagname =~ /^\Q$prefix/;
+    my $value = $opts->{$opt};
+    if (ref $value) {
+      if (UNIVERSAL::isa($value, "Imager::Color")) {
+        my $tag = sprintf("color(%d,%d,%d,%d)", $value->rgba);
+        for my $img (@imgs) {
+          $img->settag(name=>$tagname, value=>$tag);
+        }
+      }
+      elsif (ref($value) eq 'ARRAY') {
+        for my $i (0..$#$value) {
+          my $val = $value->[$i];
+          if (ref $val) {
+            if (UNIVERSAL::isa($val, "Imager::Color")) {
+              my $tag = sprintf("color(%d,%d,%d,%d)", $value->rgba);
+              $i < @imgs and
+                $imgs[$i]->settag(name=>$tagname, value=>$tag);
+            }
+            else {
+              $self->_set_error("Unknown reference type " . ref($value) . 
+                                " supplied in array for $opt");
+              return;
+            }
+          }
+          else {
+            $i < @imgs
+              and $imgs[$i]->settag(name=>$tagname, value=>$val);
+          }
+        }
+      }
+      else {
+        $self->_set_error("Unknown reference type " . ref($value) . 
+                          " supplied for $opt");
+        return;
+      }
+    }
+    else {
+      # set it as a tag for every image
+      for my $img (@imgs) {
+        $img->settag(name=>$tagname, value=>$value);
+      }
+    }
+  }
+
+  return 1;
+}
+
 # Write an image to file
 sub write {
   my $self = shift;
@@ -1175,6 +1297,9 @@ sub write {
             fax_fine=>1, @_);
   my $rc;
 
+  $self->_set_opts(\%input, "i_", $self)
+    or return undef;
+
   my %iolready=( tiff=>1, raw=>1, png=>1, pnm=>1, bmp=>1, jpeg=>1, tga=>1, 
                  gif=>1 ); # this will be SO MUCH BETTER once they are all in there
 
@@ -1197,6 +1322,11 @@ sub write {
   if ($iolready{$input{'type'}}) {
 
     if ($input{'type'} eq 'tiff') {
+      $self->_set_opts(\%input, "tiff_", $self)
+        or return undef;
+      $self->_set_opts(\%input, "exif_", $self)
+        or return undef;
+
       if (defined $input{class} && $input{class} eq 'fax') {
        if (!i_writetiff_wiol_faxable($self->{IMG}, $IO, $input{fax_fine})) {
          $self->{ERRSTR}='Could not write to buffer';
@@ -1209,36 +1339,50 @@ sub write {
        }
       }
     } elsif ( $input{'type'} eq 'pnm' ) {
+      $self->_set_opts(\%input, "pnm_", $self)
+        or return undef;
       if ( ! i_writeppm_wiol($self->{IMG},$IO) ) {
        $self->{ERRSTR}='unable to write pnm image';
        return undef;
       }
       $self->{DEBUG} && print "writing a pnm file\n";
     } elsif ( $input{'type'} eq 'raw' ) {
+      $self->_set_opts(\%input, "raw_", $self)
+        or return undef;
       if ( !i_writeraw_wiol($self->{IMG},$IO) ) {
        $self->{ERRSTR}='unable to write raw image';
        return undef;
       }
       $self->{DEBUG} && print "writing a raw file\n";
     } elsif ( $input{'type'} eq 'png' ) {
+      $self->_set_opts(\%input, "png_", $self)
+        or return undef;
       if ( !i_writepng_wiol($self->{IMG}, $IO) ) {
        $self->{ERRSTR}='unable to write png image';
        return undef;
       }
       $self->{DEBUG} && print "writing a png file\n";
     } elsif ( $input{'type'} eq 'jpeg' ) {
+      $self->_set_opts(\%input, "jpeg_", $self)
+        or return undef;
+      $self->_set_opts(\%input, "exif_", $self)
+        or return undef;
       if ( !i_writejpeg_wiol($self->{IMG}, $IO, $input{jpegquality})) {
         $self->{ERRSTR} = $self->_error_as_msg();
        return undef;
       }
       $self->{DEBUG} && print "writing a jpeg file\n";
     } elsif ( $input{'type'} eq 'bmp' ) {
+      $self->_set_opts(\%input, "bmp_", $self)
+        or return undef;
       if ( !i_writebmp_wiol($self->{IMG}, $IO) ) {
        $self->{ERRSTR}='unable to write bmp image';
        return undef;
       }
       $self->{DEBUG} && print "writing a bmp file\n";
     } elsif ( $input{'type'} eq 'tga' ) {
+      $self->_set_opts(\%input, "tga_", $self)
+        or return undef;
 
       if ( !i_writetga_wiol($self->{IMG}, $IO, $input{wierdpack}, $input{compress}, $input{idstring}) ) {
        $self->{ERRSTR}=$self->_error_as_msg();
@@ -1246,6 +1390,8 @@ sub write {
       }
       $self->{DEBUG} && print "writing a tga file\n";
     } elsif ( $input{'type'} eq 'gif' ) {
+      $self->_set_opts(\%input, "gif_", $self)
+        or return undef;
       # compatibility with the old interfaces
       if ($input{gifquant} eq 'lm') {
         $input{make_colors} = 'addi';
@@ -1289,10 +1435,14 @@ sub write_multi {
     $class->_set_error('Usage: Imager->write_multi({ options }, @images)');
     return 0;
   }
+  $class->_set_opts($opts, "i_", @images)
+    or return;
   my @work = map $_->{IMG}, @images;
   my ($IO, $file) = $class->_get_writer_io($opts, $opts->{'type'})
     or return undef;
   if ($opts->{'type'} eq 'gif') {
+    $class->_set_opts($opts, "gif_", @images)
+      or return;
     my $gif_delays = $opts->{gif_delays};
     local $opts->{gif_delays} = $gif_delays;
     if ($opts->{gif_delays} && !ref $opts->{gif_delays}) {
@@ -1304,6 +1454,10 @@ sub write_multi {
     return $res;
   }
   elsif ($opts->{'type'} eq 'tiff') {
+    $class->_set_opts($opts, "tiff_", @images)
+      or return;
+    $class->_set_opts($opts, "exif_", @images)
+      or return;
     my $res;
     $opts->{fax_fine} = 1 unless exists $opts->{fax_fine};
     if ($opts->{'class'} && $opts->{'class'} eq 'fax') {
@@ -2029,6 +2183,90 @@ sub flood_fill {
   $self;
 }
 
+sub setpixel {
+  my $self = shift;
+
+  my %opts = ( color=>$self->{fg} || NC(255, 255, 255), @_);
+
+  unless (exists $opts{'x'} && exists $opts{'y'}) {
+    $self->{ERRSTR} = 'missing x and y parameters';
+    return undef;
+  }
+
+  my $x = $opts{'x'};
+  my $y = $opts{'y'};
+  my $color = _color($opts{color})
+    or return undef;
+  if (ref $x && ref $y) {
+    unless (@$x == @$y) {
+      $self->{ERRSTR} = 'length of x and y mismatch';
+      return undef;
+    }
+    if ($color->isa('Imager::Color')) {
+      for my $i (0..$#{$opts{'x'}}) {
+        i_ppix($self->{IMG}, $x->[$i], $y->[$i], $color);
+      }
+    }
+    else {
+      for my $i (0..$#{$opts{'x'}}) {
+        i_ppixf($self->{IMG}, $x->[$i], $y->[$i], $color);
+      }
+    }
+  }
+  else {
+    if ($color->isa('Imager::Color')) {
+      i_ppix($self->{IMG}, $x, $y, $color);
+    }
+    else {
+      i_ppixf($self->{IMG}, $x, $y, $color);
+    }
+  }
+
+  $self;
+}
+
+sub getpixel {
+  my $self = shift;
+
+  my %opts = ( "type"=>'8bit', @_);
+
+  unless (exists $opts{'x'} && exists $opts{'y'}) {
+    $self->{ERRSTR} = 'missing x and y parameters';
+    return undef;
+  }
+
+  my $x = $opts{'x'};
+  my $y = $opts{'y'};
+  if (ref $x && ref $y) {
+    unless (@$x == @$y) {
+      $self->{ERRSTR} = 'length of x and y mismatch';
+      return undef;
+    }
+    my @result;
+    if ($opts{"type"} eq '8bit') {
+      for my $i (0..$#{$opts{'x'}}) {
+        push(@result, i_get_pixel($self->{IMG}, $x->[$i], $y->[$i]));
+      }
+    }
+    else {
+      for my $i (0..$#{$opts{'x'}}) {
+        push(@result, i_gpixf($self->{IMG}, $x->[$i], $y->[$i]));
+      }
+    }
+    return wantarray ? @result : \@result;
+  }
+  else {
+    if ($opts{"type"} eq '8bit') {
+      return i_get_pixel($self->{IMG}, $x, $y);
+    }
+    else {
+      return i_gpixf($self->{IMG}, $x, $y);
+    }
+  }
+
+  $self;
+}
+
 # make an identity matrix of the given size
 sub _identity {
   my ($size) = @_;
@@ -2378,20 +2616,53 @@ Imager - Perl extension for Generating 24 bit Images
 
 =head1 SYNOPSIS
 
+  # Thumbnail example
+
+  #!/usr/bin/perl -w
+  use strict;
   use Imager;
 
-  $img = Imager->new();
-  $img->open(file=>'image.ppm',type=>'pnm')
-    || print "failed: ",$img->{ERRSTR},"\n";
-  $scaled=$img->scale(xpixels=>400,ypixels=>400);
-  $scaled->write(file=>'sc_image.ppm',type=>'pnm')
-    || print "failed: ",$scaled->{ERRSTR},"\n";
+  die "Usage: thumbmake.pl filename\n" if !-f $ARGV[0];
+  my $file = shift;
+
+  my $format;
+
+  my $img = Imager->new();
+  $img->open(file=>$file) or die $img->errstr();
+
+  $file =~ s/\.[^.]*$//;
+
+  # Create smaller version
+  my $thumb = $img->scale(scalefactor=>.3);
+
+  # Autostretch individual channels
+  $thumb->filter(type=>'autolevels');
+
+  # try to save in one of these formats
+  SAVE:
+
+  for $format ( qw( png gif jpg tiff ppm ) ) {
+    # Check if given format is supported
+    if ($Imager::formats{$format}) {
+      $file.="_low.$format";
+      print "Storing image as: $file\n";
+      $thumb->write(file=>$file) or
+        die $thumb->errstr;
+      last SAVE;
+    }
+  }
+
+
+  # Logo Generator Example
+
+
 
 =head1 DESCRIPTION
 
-Imager is a module for creating and altering images - It is not meant
-as a replacement or a competitor to ImageMagick or GD. Both are
-excellent packages and well supported.
+Imager is a module for creating and altering images.  It can read and
+write various image formats, draw primitive shapes like lines,and
+polygons, blend multiple images together in various ways, scale, crop,
+render text and more.
 
 =head2 Overview of documentation
 
@@ -2399,12 +2670,13 @@ excellent packages and well supported.
 
 =item Imager
 
-This document - Table of Contents, Example and Overview
+This document - Synopsis Example, Table of Contents and Overview.
 
 =item Imager::ImageTypes
 
 Direct type/virtual images, RGB(A)/paletted images, 8/16/double
-bits/channel, image tags, and channel masks.
+bits/channel, color maps, channel masks, image tags, color
+quantization.
 
 =item Imager::Files
 
@@ -2412,27 +2684,33 @@ IO interaction, reading/writing images, format specific tags.
 
 =item Imager::Draw
 
-Drawing Primitives, lines boxes, circles, flood fill.
+Drawing Primitives, lines, boxes, circles, arcs, flood fill.
 
 =item Imager::Color
 
 Color specification.
 
+=item Imager::Fill
+
+Fill pattern specification.
+
 =item Imager::Font
 
-General font rendering.
+General font rendering, bounding boxes and font metrics.
 
 =item Imager::Transformations
 
-Copying, scaling, cropping, flipping, blending, pasting, [convert and map.]
+Copying, scaling, cropping, flipping, blending, pasting, convert and
+map.
 
 =item Imager::Engines
 
-transform2 and matrix_transform.
+Programmable transformations through C<transform()>, C<transform2()>
+and C<matrix_transform()>.
 
 =item Imager::Filters
 
-Filters, sharpen, blur, noise, convolve etc. and plugins.
+Filters, sharpen, blur, noise, convolve etc. and filter plugins.
 
 =item Imager::Expr
 
@@ -2450,507 +2728,72 @@ Helper for making gradient profiles.
 
 
 
+=head2 Basic Overview
 
+An Image object is created with C<$img = Imager-E<gt>new()>.
+Examples:
 
-
-
-
-Almost all functions take the parameters in the hash fashion.
-Example:
-
-  $img->open(file=>'lena.png',type=>'png');
-
-or just:
-
-  $img->open(file=>'lena.png');
-
-=head2 Basic concept
-
-An Image object is created with C<$img = Imager-E<gt>new()> Should
-this fail for some reason an explanation can be found in
-C<$Imager::ERRSTR> usually error messages are stored in
-C<$img-E<gt>{ERRSTR}>, but since no object is created this is the only
-way to give back errors.  C<$Imager::ERRSTR> is also used to report
-all errors not directly associated with an image object. Examples:
-
-  $img=Imager->new(); # This is an empty image (size is 0 by 0)
-  $img->open(file=>'lena.png',type=>'png'); # initializes from file
+  $img=Imager->new();                         # create empty image
+  $img->open(file=>'lena.png',type=>'png') or # read image from file
+     die $img->errstr();                      # give an explanation
+                                              # if something failed
 
 or if you want to create an empty image:
 
   $img=Imager->new(xsize=>400,ysize=>300,channels=>4);
 
-This example creates a completely black image of width 400 and
-height 300 and 4 channels.
-
-If you have an existing image, use img_set() to change it's dimensions
-- this will destroy any existing image data:
-
-  $img->img_set(xsize=>500, ysize=>500, channels=>4);
-
-To create paletted images, set the 'type' parameter to 'paletted':
-
-  $img = Imager->new(xsize=>200, ysize=>200, channels=>3, type=>'paletted');
-
-which creates an image with a maxiumum of 256 colors, which you can
-change by supplying the C<maxcolors> parameter.
-
-You can create a new paletted image from an existing image using the
-to_paletted() method:
-
- $palimg = $img->to_paletted(\%opts)
-
-where %opts contains the options specified under L<Quantization options>.
+This example creates a completely black image of width 400 and height
+300 and 4 channels.
 
-You can convert a paletted image (or any image) to an 8-bit/channel
-RGB image with:
+When an operation fails which can be directly associated with an image
+the error message is stored can be retrieved with
+C<$img-E<gt>errstr()>.
 
-  $rgbimg = $img->to_rgb8;
+In cases where no image object is associated with an operation
+C<$Imager::ERRSTR> is used to report errors not directly associated
+with an image object.
 
-Warning: if you draw on a paletted image with colors that aren't in
-the palette, the image will be internally converted to a normal image.
+=head1 SUPPORT
 
-For improved color precision you can use the bits parameter to specify
-16 bit per channel:
+You can ask for help, report bugs or express your undying love for
+Imager on the Imager-devel mailing list.
 
-  $img = Imager->new(xsize=>200, ysize=>200, channels=>3, bits=>16);
+To subscribe send a message with C<subscribe> in the body to:
 
-or for even more precision:
-
-  $img = Imager->new(xsize=>200, ysize=>200, channels=>3, bits=>'double');
-
-to get an image that uses a double for each channel.
-
-Note that as of this writing all functions should work on images with
-more than 8-bits/channel, but many will only work at only
-8-bit/channel precision.
-
-Currently only 8-bit, 16-bit, and double per channel image types are
-available, this may change later.
-
-Color objects are created by calling the Imager::Color->new()
-method:
-
-  $color = Imager::Color->new($red, $green, $blue);
-  $color = Imager::Color->new($red, $green, $blue, $alpha);
-  $color = Imager::Color->new("#C0C0FF"); # html color specification
-
-This object can then be passed to functions that require a color parameter.
-
-Coordinates in Imager have the origin in the upper left corner.  The
-horizontal coordinate increases to the right and the vertical
-downwards.
-
-=head2 Reading and writing images
-
-You can read and write a variety of images formats, assuming you have
-the appropriate libraries, and images can be read or written to/from
-files, file handles, file descriptors, scalars, or through callbacks.
-
-To see which image formats Imager is compiled to support the following
-code snippet is sufficient:
-
-  use Imager;
-  print join " ", keys %Imager::formats;
-
-This will include some other information identifying libraries rather
-than file formats.
-
-Reading writing to and from files is simple, use the C<read()>
-method to read an image:
-
-  my $img = Imager->new;
-  $img->read(file=>$filename, type=>$type)
-    or die "Cannot read $filename: ", $img->errstr;
-
-and the C<write()> method to write an image:
-
-  $img->write(file=>$filename, type=>$type)
-    or die "Cannot write $filename: ", $img->errstr;
-
-If the I<filename> includes an extension that Imager recognizes, then
-you don't need the I<type>, but you may want to provide one anyway.
-Imager currently does not check the files magic to determine the
-format.  It is possible to override the method for determining the 
-filetype from the filename.  If the data is given in another form than
-a file name a 
-
-When you read an image, Imager may set some tags, possibly including
-information about the spatial resolution, textual information, and
-animation information.  See L</Tags> for specifics.
-
-When reading or writing you can specify one of a variety of sources or
-targets:
-
-=over
-
-=item file
-
-The C<file> parameter is the name of the image file to be written to
-or read from.  If Imager recognizes the extension of the file you do
-not need to supply a C<type>.
-
-=item fh
-
-C<fh> is a file handle, typically either returned from
-C<<IO::File->new()>>, or a glob from an C<open> call.  You should call
-C<binmode> on the handle before passing it to Imager.
-
-=item fd
-
-C<fd> is a file descriptor.  You can get this by calling the
-C<fileno()> function on a file handle, or by using one of the standard
-file descriptor numbers.
-
-=item data
-
-When reading data, C<data> is a scalar containing the image file data,
-when writing, C<data> is a reference to the scalar to save the image
-file data too.  For GIF images you will need giflib 4 or higher, and
-you may need to patch giflib to use this option for writing.
-
-=item callback
-
-Imager will make calls back to your supplied coderefs to read, write
-and seek from/to/through the image file.
-
-When reading from a file you can use either C<callback> or C<readcb>
-to supply the read callback, and when writing C<callback> or
-C<writecb> to supply the write callback.
-
-When writing you can also supply the C<maxbuffer> option to set the
-maximum amount of data that will be buffered before your write
-callback is called.  Note: the amount of data supplied to your
-callback can be smaller or larger than this size.
-
-The read callback is called with 2 parameters, the minimum amount of
-data required, and the maximum amount that Imager will store in it's C
-level buffer.  You may want to return the minimum if you have a slow
-data source, or the maximum if you have a fast source and want to
-prevent many calls to your perl callback.  The read data should be
-returned as a scalar.
-
-Your write callback takes exactly one parameter, a scalar containing
-the data to be written.  Return true for success.
-
-The seek callback takes 2 parameters, a I<POSITION>, and a I<WHENCE>,
-defined in the same way as perl's seek function.
-
-You can also supply a C<closecb> which is called with no parameters
-when there is no more data to be written.  This could be used to flush
-buffered data.
-
-=back
-
-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
-
-This is C<gif> for gif animations.
-
-=item callback
-
-A code reference which is called with a single parameter, the data to
-be written.  You can also specify $opts{maxbuffer} which is the
-maximum amount of data buffered.  Note that there can be larger writes
-than this if the file library writes larger blocks.  A smaller value
-maybe useful for writing to a socket for incremental display.
-
-=item fd
-
-The file descriptor to save the images to.
-
-=item file
-
-The name of the file to write to.
-
-%opts may also include the keys from L<Gif options> and L<Quantization
-options>.
-
-=back
-
-You must also specify the file format using the 'type' option.
-
-The current aim is to support other multiple image formats in the
-future, such as TIFF, and to support reading multiple images from a
-single file.
-
-A simple example:
-
-    my @images;
-    # ... code to put images in @images
-    Imager->write_multi({type=>'gif',
-                        file=>'anim.gif',
-                        gif_delays=>[ (10) x @images ] },
-                       @images)
-    or die "Oh dear!";
-
-You can read multi-image files (currently only GIF files) using the
-read_multi() method:
-
-  my @imgs = Imager->read_multi(file=>'foo.gif')
-    or die "Cannot read images: ",Imager->errstr;
-
-The possible parameters for read_multi() are:
-
-=over
-
-=item file
-
-The name of the file to read in.
-
-=item fh
-
-A filehandle to read in.  This can be the name of a filehandle, but it
-will need the package name, no attempt is currently made to adjust
-this to the caller's package.
-
-=item fd
-
-The numeric file descriptor of an open file (or socket).
-
-=item callback
-
-A function to be called to read in data, eg. reading a blob from a
-database incrementally.
-
-=item data
-
-The data of the input file in memory.
-
-=item type
-
-The type of file.  If the file is parameter is given and provides
-enough information to guess the type, then this parameter is optional.
-
-=back
-
-Note: you cannot use the callback or data parameter with giflib
-versions before 4.0.
-
-When reading from a GIF file with read_multi() the images are returned
-as paletted images.
-
-=head2 Gif options
-
-These options can be specified when calling write_multi() for gif
-files, when writing a single image with the gifquant option set to
-'gen', or for direct calls to i_writegif_gen and i_writegif_callback.
-
-Note that some viewers will ignore some of these options
-(gif_user_input in particular).
-
-=over 4
-
-=item gif_each_palette
-
-Each image in the gif file has it's own palette if this is non-zero.
-All but the first image has a local colour table (the first uses the
-global colour table.
-
-=item interlace
-
-The images are written interlaced if this is non-zero.
-
-=item gif_delays
-
-A reference to an array containing the delays between images, in 1/100
-seconds.
-
-If you want the same delay for every frame you can simply set this to
-the delay in 1/100 seconds.
-
-=item gif_user_input
-
-A reference to an array contains user input flags.  If the given flag
-is non-zero the image viewer should wait for input before displaying
-the next image.
-
-=item gif_disposal
-
-A reference to an array of image disposal methods.  These define what
-should be done to the image before displaying the next one.  These are
-integers, where 0 means unspecified, 1 means the image should be left
-in place, 2 means restore to background colour and 3 means restore to
-the previous value.
-
-=item gif_tran_color
-
-A reference to an Imager::Color object, which is the colour to use for
-the palette entry used to represent transparency in the palette.  You
-need to set the transp option (see L<Quantization options>) for this
-value to be used.
-
-=item gif_positions
-
-A reference to an array of references to arrays which represent screen
-positions for each image.
-
-=item gif_loop_count
-
-If this is non-zero the Netscape loop extension block is generated,
-which makes the animation of the images repeat.
-
-This is currently unimplemented due to some limitations in giflib.
-
-=item gif_eliminate_unused
-
-If this is true, when you write a paletted image any unused colors
-will be eliminated from its palette.  This is set by default.
-
-=back
+   imager-devel+request@molar.is
 
+or use the form at:
 
+   http://www.molar.is/en/lists/imager-devel/
+   (annonymous is temporarily off due to spam)
 
+where you can also find the mailing list archive.
 
+If you're into IRC, you can typically find the developers in #Imager
+on irc.rhizomatic.net.  As with any IRC channel, the participants
+could be occupied or asleep, so please be patient.
 
 =head1 BUGS
 
-box, arc, circle do not support antialiasing yet.  arc, is only filled
-as of yet.  Some routines do not return $self where they should.  This
-affects code like this, C<$img-E<gt>box()-E<gt>arc()> where an object
-is expected.
-
-When saving Gif images the program does NOT try to shave of extra
-colors if it is possible.  If you specify 128 colors and there are
-only 2 colors used - it will have a 128 colortable anyway.
+Bugs are listed individually for relevant pod pages.
 
 =head1 AUTHOR
 
-Arnar M. Hrafnkelsson, addi@umich.edu, and recently lots of assistance
-from Tony Cook.  See the README for a complete list.
+Arnar M. Hrafnkelsson (addi@imager.perl.org) and Tony Cook
+(tony@imager.perl.org) See the README for a complete list.
 
 =head1 SEE ALSO
 
-perl(1), Imager::Color(3), Imager::Font(3), Imager::Matrix2d(3),
-Affix::Infix2Postfix(3), Parse::RecDescent(3) 
+perl(1), Imager::ImageTypes(3), Imager::Files(3), Imager::Draw(3),
+Imager::Color(3), Imager::Fill(3), Imager::Font(3),
+Imager::Transformations(3), Imager::Engines(3), Imager::Filters(3),
+Imager::Expr(3), Imager::Matrix2d(3), Imager::Fountain(3)
+
+Affix::Infix2Postfix(3), Parse::RecDescent(3)
 http://www.eecs.umich.edu/~addi/perl/Imager/
 
 =cut
+
+
+
+