]> git.imager.perl.org - imager.git/blobdiff - Imager.pm
bump to 0.52
[imager.git] / Imager.pm
index ecb6d6f91b15a7d046ef2917377c419be0e62e04..3d9b9dedb82c26e9aac2e3fbaa8bb5d4837db602 100644 (file)
--- a/Imager.pm
+++ b/Imager.pm
@@ -146,13 +146,16 @@ use Imager::Font;
 # registered file readers
 my %readers;
 
+# registered file writers
+my %writers;
+
 # modules we attempted to autoload
 my %attempted_to_load;
 
 BEGIN {
   require Exporter;
   @ISA = qw(Exporter);
-  $VERSION = '0.49';
+  $VERSION = '0.52';
   eval {
     require XSLoader;
     XSLoader::load(Imager => $VERSION);
@@ -534,12 +537,7 @@ sub _color {
         $result = Imager::Color->new(%$arg);
       }
       elsif ($copy =~ /^ARRAY\(/) {
-        if (grep $_ > 1, @$arg) {
-          $result = Imager::Color->new(@$arg);
-        }
-        else {
-          $result = Imager::Color::Float->new(@$arg);
-        }
+       $result = Imager::Color->new(@$arg);
       }
       else {
         $Imager::ERRSTR = "Not a color";
@@ -637,7 +635,7 @@ sub paste {
     else {
       $src_right = $r;
     }
-    if (defined $input{src_maxx}) {
+    if (defined $input{src_maxy}) {
       $src_bottom = $input{src_maxy};
     }
     elsif (defined $input{height}) {
@@ -653,7 +651,7 @@ sub paste {
   }
 
   $src_right > $r and $src_right = $r;
-  $src_bottom > $r and $src_bottom = $b;
+  $src_bottom > $b and $src_bottom = $b;
 
   if ($src_right <= $src_left
       || $src_bottom < $src_top) {
@@ -894,17 +892,46 @@ sub addcolors {
   my $self = shift;
   my %opts = (colors=>[], @_);
 
-  @{$opts{colors}} or return undef;
+  unless ($self->{IMG}) {
+    $self->_set_error("empty input image");
+    return;
+  }
+
+  my @colors = @{$opts{colors}}
+    or return undef;
 
-  $self->{IMG} and i_addcolors($self->{IMG}, @{$opts{colors}});
+  for my $color (@colors) {
+    $color = _color($color);
+    unless ($color) {
+      $self->_set_error($Imager::ERRSTR);
+      return;
+    }  
+  }
+
+  return i_addcolors($self->{IMG}, @colors);
 }
 
 sub setcolors {
   my $self = shift;
   my %opts = (start=>0, colors=>[], @_);
-  @{$opts{colors}} or return undef;
 
-  $self->{IMG} and i_setcolors($self->{IMG}, $opts{start}, @{$opts{colors}});
+  unless ($self->{IMG}) {
+    $self->_set_error("empty input image");
+    return;
+  }
+
+  my @colors = @{$opts{colors}}
+    or return undef;
+
+  for my $color (@colors) {
+    $color = _color($color);
+    unless ($color) {
+      $self->_set_error($Imager::ERRSTR);
+      return;
+    }  
+  }
+
+  return i_setcolors($self->{IMG}, $opts{start}, @colors);
 }
 
 sub getcolors {
@@ -1370,6 +1397,28 @@ sub register_reader {
   return 1;
 }
 
+sub register_writer {
+  my ($class, %opts) = @_;
+
+  defined $opts{type}
+    or die "register_writer called with no type parameter\n";
+
+  my $type = $opts{type};
+
+  defined $opts{single} || defined $opts{multiple}
+    or die "register_writer called with no single or multiple parameter\n";
+
+  $writers{$type} = {  };
+  if ($opts{single}) {
+    $writers{$type}{single} = $opts{single};
+  }
+  if ($opts{multiple}) {
+    $writers{$type}{multiple} = $opts{multiple};
+  }
+
+  return 1;
+}
+
 # probes for an Imager::File::whatever module
 sub _reader_autoload {
   my $type = shift;
@@ -1385,6 +1434,44 @@ sub _reader_autoload {
       ++$attempted_to_load{$file};
       require $file;
     };
+    if ($@) {
+      # try to get a reader specific module
+      my $file = "Imager/File/\U$type\EReader.pm";
+      unless ($attempted_to_load{$file}) {
+       eval {
+         ++$attempted_to_load{$file};
+         require $file;
+       };
+      }
+    }
+  }
+}
+
+# probes for an Imager::File::whatever module
+sub _writer_autoload {
+  my $type = shift;
+
+  return if $formats{$type} || $readers{$type};
+
+  return unless $type =~ /^\w+$/;
+
+  my $file = "Imager/File/\U$type\E.pm";
+
+  unless ($attempted_to_load{$file}) {
+    eval {
+      ++$attempted_to_load{$file};
+      require $file;
+    };
+    if ($@) {
+      # try to get a writer specific module
+      my $file = "Imager/File/\U$type\EWriter.pm";
+      unless ($attempted_to_load{$file}) {
+       eval {
+         ++$attempted_to_load{$file};
+         require $file;
+       };
+      }
+    }
   }
 }
 
@@ -1502,96 +1589,111 @@ sub write {
     return undef;
   }
 
-  if (!$formats{$input{'type'}}) { $self->{ERRSTR}='format not supported'; return undef; }
-
-  my ($IO, $fh) = $self->_get_writer_io(\%input, $input{'type'})
-    or return undef;
+  _writer_autoload($input{type});
 
-  if ($input{'type'} eq 'tiff') {
-    $self->_set_opts(\%input, "tiff_", $self)
-      or return undef;
-    $self->_set_opts(\%input, "exif_", $self)
+  my ($IO, $fh);
+  if ($writers{$input{type}} && $writers{$input{type}}{single}) {
+    ($IO, $fh) = $self->_get_writer_io(\%input, $input{'type'})
       or return undef;
 
-    if (defined $input{class} && $input{class} eq 'fax') {
-      if (!i_writetiff_wiol_faxable($self->{IMG}, $IO, $input{fax_fine})) {
-       $self->{ERRSTR} = $self->_error_as_msg();
-       return undef;
-      }
-    } else {
-      if (!i_writetiff_wiol($self->{IMG}, $IO)) {
-       $self->{ERRSTR} = $self->_error_as_msg();
-       return undef;
-      }
-    }
-  } elsif ( $input{'type'} eq 'pnm' ) {
-    $self->_set_opts(\%input, "pnm_", $self)
-      or return undef;
-    if ( ! i_writeppm_wiol($self->{IMG},$IO) ) {
-      $self->{ERRSTR} = $self->_error_as_msg();
-      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} = $self->_error_as_msg();
-      return undef;
-    }
-    $self->{DEBUG} && print "writing a raw file\n";
-  } elsif ( $input{'type'} eq 'png' ) {
-    $self->_set_opts(\%input, "png_", $self)
+    $writers{$input{type}}{single}->($self, $IO, %input)
       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();
+  }
+  else {
+    if (!$formats{$input{'type'}}) { 
+      $self->{ERRSTR}='format not supported'; 
       return undef;
     }
-    $self->{DEBUG} && print "writing a tga file\n";
-  } elsif ( $input{'type'} eq 'gif' ) {
-    $self->_set_opts(\%input, "gif_", $self)
+    
+    ($IO, $fh) = $self->_get_writer_io(\%input, $input{'type'})
       or return undef;
-    # compatibility with the old interfaces
-    if ($input{gifquant} eq 'lm') {
-      $input{make_colors} = 'addi';
-      $input{translate} = 'perturb';
-      $input{perturb} = $input{lmdither};
-    } elsif ($input{gifquant} eq 'gen') {
-      # just pass options through
-    } else {
-      $input{make_colors} = 'webmap'; # ignored
-      $input{translate} = 'giflib';
-    }
-    if (!i_writegif_wiol($IO, \%input, $self->{IMG})) {
-      $self->{ERRSTR} = $self->_error_as_msg;
-      return;
+    
+    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} = $self->_error_as_msg();
+          return undef;
+        }
+      } else {
+        if (!i_writetiff_wiol($self->{IMG}, $IO)) {
+          $self->{ERRSTR} = $self->_error_as_msg();
+          return undef;
+        }
+      }
+    } elsif ( $input{'type'} eq 'pnm' ) {
+      $self->_set_opts(\%input, "pnm_", $self)
+        or return undef;
+      if ( ! i_writeppm_wiol($self->{IMG},$IO) ) {
+        $self->{ERRSTR} = $self->_error_as_msg();
+        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} = $self->_error_as_msg();
+        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();
+        return undef;
+      }
+      $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';
+        $input{translate} = 'perturb';
+        $input{perturb} = $input{lmdither};
+      } elsif ($input{gifquant} eq 'gen') {
+        # just pass options through
+      } else {
+        $input{make_colors} = 'webmap'; # ignored
+        $input{translate} = 'giflib';
+      }
+      if (!i_writegif_wiol($IO, \%input, $self->{IMG})) {
+        $self->{ERRSTR} = $self->_error_as_msg;
+        return;
+      }
     }
   }
 
@@ -1609,10 +1711,12 @@ sub write {
 sub write_multi {
   my ($class, $opts, @images) = @_;
 
-  if (!$opts->{'type'} && $opts->{'file'}) {
-    $opts->{'type'} = $FORMATGUESS->($opts->{'file'});
+  my $type = $opts->{type};
+
+  if (!$type && $opts->{'file'}) {
+    $type = $FORMATGUESS->($opts->{'file'});
   }
-  unless ($opts->{'type'}) {
+  unless ($type) {
     $class->_set_error('type parameter missing and not possible to guess from extension');
     return;
   }
@@ -1624,41 +1728,73 @@ sub write_multi {
   $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}) {
-      # assume the caller wants the same delay for each frame
-      $opts->{gif_delays} = [ ($gif_delays) x @images ];
-    }
-    my $res = i_writegif_wiol($IO, $opts, @work);
-    $res or $class->_set_error($class->_error_as_msg());
-    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') {
-      $res = i_writetiff_multi_wiol_faxable($IO, $opts->{fax_fine}, @work);
+
+  _writer_autoload($type);
+
+  my ($IO, $file);
+  if ($writers{$type} && $writers{$type}{multiple}) {
+    ($IO, $file) = $class->_get_writer_io($opts, $type)
+      or return undef;
+
+    $writers{$type}{multiple}->($class, $IO, $opts, @images)
+      or return undef;
+  }
+  else {
+    if (!$formats{$type}) { 
+      $class->_set_error("format $type not supported"); 
+      return undef;
+    }
+    
+    ($IO, $file) = $class->_get_writer_io($opts, $type)
+      or return undef;
+    
+    if ($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}) {
+        # assume the caller wants the same delay for each frame
+        $opts->{gif_delays} = [ ($gif_delays) x @images ];
+      }
+      unless (i_writegif_wiol($IO, $opts, @work)) {
+        $class->_set_error($class->_error_as_msg());
+        return undef;
+      }
+    }
+    elsif ($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') {
+        $res = i_writetiff_multi_wiol_faxable($IO, $opts->{fax_fine}, @work);
+      }
+      else {
+        $res = i_writetiff_multi_wiol($IO, @work);
+      }
+      unless ($res) {
+        $class->_set_error($class->_error_as_msg());
+        return undef;
+      }
     }
     else {
-      $res = i_writetiff_multi_wiol($IO, @work);
+      $ERRSTR = "Sorry, write_multi doesn't support $type yet";
+      return 0;
     }
-    $res or $class->_set_error($class->_error_as_msg());
-    return $res;
   }
-  else {
-    $ERRSTR = "Sorry, write_multi doesn't support $opts->{'type'} yet";
-    return 0;
+
+  if (exists $opts->{'data'}) {
+    my $data = io_slurp($IO);
+    if (!$data) {
+      Imager->_set_error('Could not slurp from buffer');
+      return undef;
+    }
+    ${$opts->{data}} = $data;
   }
+  return 1;
 }
 
 # read multiple images from a file
@@ -1715,7 +1851,7 @@ sub read_multi {
     }
   }
 
-  $ERRSTR = "Cannot read multiple images from $opts{'type'} files";
+  $ERRSTR = "Cannot read multiple images from $type files";
   return;
 }
 
@@ -2548,26 +2684,69 @@ sub flood_fill {
     return undef;
   }
 
-  if ($opts{fill}) {
-    unless (UNIVERSAL::isa($opts{fill}, 'Imager::Fill')) {
-      # assume it's a hash ref
-      require 'Imager/Fill.pm';
-      unless ($opts{fill} = Imager::Fill->new(%{$opts{fill}})) {
-        $self->{ERRSTR} = $Imager::ERRSTR;
-        return;
+  if ($opts{border}) {
+    my $border = _color($opts{border});
+    unless ($border) {
+      $self->_set_error($Imager::ERRSTR);
+      return;
+    }
+    if ($opts{fill}) {
+      unless (UNIVERSAL::isa($opts{fill}, 'Imager::Fill')) {
+       # assume it's a hash ref
+       require Imager::Fill;
+       unless ($opts{fill} = Imager::Fill->new(%{$opts{fill}})) {
+         $self->{ERRSTR} = $Imager::ERRSTR;
+         return;
+       }
       }
+      $rc = i_flood_cfill_border($self->{IMG}, $opts{'x'}, $opts{'y'}, 
+                                $opts{fill}{fill}, $border);
+    }
+    else {
+      my $color = _color($opts{'color'});
+      unless ($color) {
+       $self->{ERRSTR} = $Imager::ERRSTR;
+       return;
+      }
+      $rc = i_flood_fill_border($self->{IMG}, $opts{'x'}, $opts{'y'}, 
+                               $color, $border);
+    }
+    if ($rc) { 
+      return $self; 
+    } 
+    else { 
+      $self->{ERRSTR} = $self->_error_as_msg(); 
+      return;
     }
-    $rc = i_flood_cfill($self->{IMG}, $opts{'x'}, $opts{'y'}, $opts{fill}{fill});
   }
   else {
-    my $color = _color($opts{'color'});
-    unless ($color) {
-      $self->{ERRSTR} = $Imager::ERRSTR;
+    if ($opts{fill}) {
+      unless (UNIVERSAL::isa($opts{fill}, 'Imager::Fill')) {
+       # assume it's a hash ref
+       require 'Imager/Fill.pm';
+       unless ($opts{fill} = Imager::Fill->new(%{$opts{fill}})) {
+         $self->{ERRSTR} = $Imager::ERRSTR;
+         return;
+       }
+      }
+      $rc = i_flood_cfill($self->{IMG}, $opts{'x'}, $opts{'y'}, $opts{fill}{fill});
+    }
+    else {
+      my $color = _color($opts{'color'});
+      unless ($color) {
+       $self->{ERRSTR} = $Imager::ERRSTR;
+       return;
+      }
+      $rc = i_flood_fill($self->{IMG}, $opts{'x'}, $opts{'y'}, $color);
+    }
+    if ($rc) { 
+      return $self; 
+    } 
+    else { 
+      $self->{ERRSTR} = $self->_error_as_msg(); 
       return;
     }
-    $rc = i_flood_fill($self->{IMG}, $opts{'x'}, $opts{'y'}, $color);
-  }
-  if ($rc) { $self; } else { $self->{ERRSTR} = $self->_error_as_msg(); return (); }
+  } 
 }
 
 sub setpixel {
@@ -3123,6 +3302,7 @@ sub def_guess_type {
   return 'rgb'  if ($ext eq "rgb");
   return 'gif'  if ($ext eq "gif");
   return 'raw'  if ($ext eq "raw");
+  return lc $ext; # best guess
   return ();
 }
 
@@ -3267,7 +3447,7 @@ render text and more.
 
 =item *
 
-Imager - This document - Synopsis Example, Table of Contents and
+Imager - This document - Synopsis, Example, Table of Contents and
 Overview.
 
 =item *
@@ -3371,14 +3551,32 @@ or if you want to create an empty image:
 This example creates a completely black image of width 400 and height
 300 and 4 channels.
 
-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()>.
+=head1 ERROR HANDLING
+
+In general a method will return false when it fails, if it does use the errstr() method to find out why:
+
+=over
+
+=item errstr
+
+Returns the last error message in that context.
+
+If the last error you received was from calling an object method, such
+as read, call errstr() as an object method to find out why:
+
+  my $image = Imager->new;
+  $image->read(file => 'somefile.gif')
+     or die $image->errstr;
+
+If it was a class method then call errstr() as a class method:
+
+  my @imgs = Imager->read_multi(file => 'somefile.gif')
+    or die Imager->errstr;
 
-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.  You can also call C<Imager->errstr> to get this
-value.
+Note that in some cases object methods are implemented in terms of
+class methods so a failing object method may set both.
+
+=back
 
 The C<Imager-E<gt>new> method is described in detail in
 L<Imager::ImageTypes>.
@@ -3391,10 +3589,10 @@ addcolors() -  L<Imager::ImageTypes/addcolors>
 
 addtag() -  L<Imager::ImageTypes/addtag> - add image tags
 
-arc() - L<Imager::Draw/arc>
-
 align_string() - L<Imager::Draw/align_string>
 
+arc() - L<Imager::Draw/arc>
+
 bits() - L<Imager::ImageTypes/bits> - number of bits per sample for the
 image
 
@@ -3411,6 +3609,8 @@ copy() - L<Imager::Transformations/copy>
 
 crop() - L<Imager::Transformations/crop> - extract part of an image
 
+def_guess_type() - L<Imager::Files/def_guess_type>
+
 deltag() -  L<Imager::ImageTypes/deltag> - delete image tags
 
 difference() - L<Imager::Filters/"Image Difference">
@@ -3437,6 +3637,8 @@ get_file_limits() - L<Imager::Files/"Limiting the sizes of images you read">
 
 getheight() - L<Imager::ImageTypes/getwidth>
 
+getmask() - L<Imager::ImageTypes/getmask>
+
 getpixel() - L<Imager::Draw/getpixel>
 
 getsamples() - L<Imager::Draw/getsamples>
@@ -3447,8 +3649,12 @@ getwidth() - L<Imager::ImageTypes/getwidth>
 
 img_set() - L<Imager::ImageTypes/img_set>
 
+init() - L<Imager::ImageTypes/init>
+
 line() - L<Imager::Draw/line>
 
+load_plugin() - L<Imager::Filters/load_plugin>
+
 map() - L<Imager::Transformations/"Color Mappings"> - remap color
 channel values
 
@@ -3458,10 +3664,23 @@ matrix_transform() - L<Imager::Engines/matrix_transform>
 
 maxcolors() - L<Imager::ImageTypes/maxcolors>
 
+NC() - L<Imager::Handy/NC>
+
 new() - L<Imager::ImageTypes/new>
 
+newcolor() - L<Imager::Handy/newcolor>
+
+newcolour() - L<Imager::Handy/newcolour>
+
+newfont() - L<Imager::Handy/newfont>
+
+NF() - L<Imager::Handy/NF>
+
 open() - L<Imager::Files> - an alias for read()
 
+parseiptc() - L<Imager::Files/parseiptc> - parse IPTC data from a JPEG
+image
+
 paste() - L<Imager::Transformations/paste> - draw an image onto an image
 
 polygon() - L<Imager::Draw/polygon>
@@ -3473,6 +3692,12 @@ read() - L<Imager::Files> - read a single image from an image file
 read_multi() - L<Imager::Files> - read multiple images from an image
 file
 
+register_filter() - L<Imager::Filters/register_filter>
+
+register_reader() - L<Imager::Filters/register_reader>
+
+register_writer() - L<Imager::Filters/register_writer>
+
 rotate() - L<Imager::Transformations/rotate>
 
 rubthrough() - L<Imager::Transformations/rubthrough> - draw an image onto an
@@ -3487,14 +3712,16 @@ scaleY() - L<Imager::Transformations/scaleY>
 setcolors() - L<Imager::ImageTypes/setcolors> - set palette colors in
 a paletted image
 
+set_file_limits() - L<Imager::Files/"Limiting the sizes of images you read">
+
+setmask() - L<Imager::ImageTypes/setmask>
+
 setpixel() - L<Imager::Draw/setpixel>
 
 setscanline() - L<Imager::Draw/setscanline>
 
 settag() - L<Imager::ImageTypes/settag>
 
-set_file_limits() - L<Imager::Files/"Limiting the sizes of images you read">
-
 string() - L<Imager::Draw/string> - draw text on an image
 
 tags() -  L<Imager::ImageTypes/tags> - fetch image tags
@@ -3509,6 +3736,8 @@ transform2() - L<Imager::Engines/"transform2">
 
 type() -  L<Imager::ImageTypes/type> - type of image (direct vs paletted)
 
+unload_plugin() - L<Imager::Filters/unload_plugin>
+
 virtual() - L<Imager::ImageTypes/virtual> - whether the image has it's own
 data
 
@@ -3549,13 +3778,14 @@ cropping - L<Imager::Transformations/crop>
 
 C<diff> images - L<Imager::Filter/"Image Difference">
 
-dpi - L<Imager::ImageTypes/i_xres>
+dpi - L<Imager::ImageTypes/i_xres>, 
+L<Imager::Cookbook/"Image spatial resolution">
 
 drawing boxes - L<Imager::Draw/box>
 
 drawing lines - L<Imager::Draw/line>
 
-drawing text - L<Imager::Font/string>, L<Imager::Font/align>
+drawing text - L<Imager::Draw/string>, L<Imager::Draw/align_string>
 
 error message - L<"Basic Overview">
 
@@ -3573,8 +3803,8 @@ flood fill - L<Imager::Draw/flood_fill>
 
 fonts - L<Imager::Font>
 
-fonts, drawing with - L<Imager::Font/string>, L<Imager::Font/align>,
-L<Imager::Font::Wrap>
+fonts, drawing with - L<Imager::Draw/string>,
+L<Imager::Draw/align_string>, L<Imager::Font::Wrap>
 
 fonts, metrics - L<Imager::Font/bounding_box>, L<Imager::Font::BBox>