]> git.imager.perl.org - imager.git/blobdiff - lib/Imager/Files.pod
API documentation (mostly)
[imager.git] / lib / Imager / Files.pod
index 45a68a85ffad68b59056dd0eef3ab84fc3b5f88a..b7d612bf4d47357c3da2e4f3c4fa100fce16f486 100644 (file)
@@ -4,6 +4,7 @@ Imager::Files - working with image files
 
 =head1 SYNOPSIS
 
+  use Imager;
   my $img = ...;
   $img->write(file=>$filename, type=>$type)
     or die "Cannot write: ",$img->errstr;
@@ -50,6 +51,10 @@ Imager::Files - working with image files
   $img->read(fd => fileno($fh)) or die;
   $img->read(callback => \&read_callback) or die;
 
+  use Imager 0.68;
+  my $img = Imager->new(file => $filename)
+    or die Imager->errstr;
+
 =head1 DESCRIPTION
 
 You can read and write a variety of images formats, assuming you have
@@ -87,6 +92,14 @@ The read() method accepts the C<allow_partial> parameter.  If this is
 non-zero then read() can return true on an incomplete image and set
 the C<i_incomplete> tag.
 
+From Imager 0.68 you can supply most read() parameters to the new()
+method to read the image file on creation.  If the read fails, check
+Imager->errstr() for the cause:
+
+  use Imager 0.68;
+  my $img = Imager->new(file => $filename)
+    or die "Cannot read $filename: ", Imager->errstr;
+
 =item write
 
 and the C<write()> method to write an image:
@@ -1239,7 +1252,7 @@ paletted image being returned as a direct color image.  Default: 1
     or die $img->errstr;
 
 This was introduced in Imager 0.60.  Previously reading ICO images
-acted as if C<<ico_masked => 0>>.
+acted as if C<ico_masked =E<gt> 0>.
 
 =back