]> git.imager.perl.org - imager.git/commitdiff
update the TIFF documentation
authorTony Cook <tony@develop=help.com>
Mon, 12 Apr 2010 11:58:09 +0000 (11:58 +0000)
committerTony Cook <tony@develop=help.com>
Mon, 12 Apr 2010 11:58:09 +0000 (11:58 +0000)
Changes
lib/Imager/Files.pod

diff --git a/Changes b/Changes
index 97459e1fed34732e9c5ec1c9109d650a278ef707..065d77fcd1f297eedd58ffc9ea8f20f07040c6a7 100644 (file)
--- a/Changes
+++ b/Changes
@@ -14,6 +14,9 @@ Bug fixes:
 
  - add an (unshipped) author test to spellcheck Imager's POD.
 
+ - update the TIFF file format documentation
+   https://rt.cpan.org/Ticket/Display.html?id=56510
+
 Imager 0.73 - 15 Mar 2010
 ===========
 
index 13baa7823326d441d7af5b7fff7ae922f0c28ca9..f9f6a7a15f2c326855a846ae7dea9fea632c1ea3 100644 (file)
@@ -784,9 +784,40 @@ objects of the color table generated for the image file.
 =head2 TIFF (Tagged Image File Format)
 
 Imager can write images to either paletted or RGB TIFF images,
-depending on the type of the source image.  Currently if you write a
-16-bit/sample or double/sample image it will be written as an
-8-bit/sample image.  Only 1 or 3 channel images can be written.
+depending on the type of the source image.
+
+When writing direct color images to TIFF the sample size of the
+output file depends on the input:
+
+=over
+
+=item *
+
+double/sample - written as 32-bit/sample TIFF
+
+=item *
+
+16-bit/sample - written as 16-bit/sample TIFF
+
+=item *
+
+8-bit/sample - written as 8-bit/sample TIFF
+
+=back
+
+For paletted images:
+
+=over
+
+=item *
+
+C<< $img->is_bilevel >> is true - the image is written as bi-level
+
+=item *
+
+otherwise - image is written as paletted.
+
+=back
 
 If you are creating images for faxing you can set the I<class>
 parameter set to C<fax>.  By default the image is written in fine
@@ -804,22 +835,23 @@ use dithering:
 
 =over
 
-=item class
+=item *
 
-If set to 'fax' the image will be written as a bi-level fax image.
+C<class> - If set to 'fax' the image will be written as a bi-level fax
+image.
 
-=item fax_fine
+=item *
 
-By default when I<class> is set to 'fax' the image is written in fine
-mode, you can select normal mode by setting I<fax_fine> to 0.
+C<fax_fine> - By default when C<class> is set to 'fax' the image is
+written in fine mode, you can select normal mode by setting
+C<fax_fine> to 0.
 
 =back
 
 Imager should be able to read any TIFF image you supply.  Paletted
 TIFF images are read as paletted Imager images, since paletted TIFF
 images have 16-bits/sample (48-bits/color) this means the bottom
-8-bits are lost, but this shouldn't be a big deal.  Currently all
-direct color images are read at 8-bits/sample.
+8-bits are lost, but this shouldn't be a big deal.
 
 TIFF supports the spatial resolution tags.  See the
 C<tiff_resolutionunit> tag for some extra options.
@@ -830,6 +862,11 @@ As of Imager 0.62 Imager reads:
 
 =item *
 
+8-bit/sample gray, RGB or CMYK images, including a possible alpha
+channel as an 8-bit/sample image.
+
+=item *
+
 16-bit gray, RGB, or CMYK image, including a possible alpha channel as
 a 16-bit/sample image.
 
@@ -847,6 +884,11 @@ which other formats will also write as bi-level.
 
 tiled paletted images are now handled correctly
 
+=item *
+
+other images are read using C<tifflib>'s RGBA interface as
+8-bit/sample images.
+
 =back
 
 The following tags are set in a TIFF image when read, and can be set
@@ -854,10 +896,10 @@ to control output:
 
 =over
 
-=item tiff_compression
+=item *
 
-When reading an image this is set to the numeric value of the TIFF
-compression tag.
+C<tiff_compression> - When reading an image this is set to the numeric
+value of the TIFF compression tag.
 
 On writing you can set this to either a numeric compression tag value,
 or one of the following values:
@@ -892,61 +934,51 @@ C<libjpeg>'s location.
   $im->write(file => 'foo.tif', tiff_compression => 'lzw')
     or die $im->errstr;
 
-=item tiff_jpegquality
+=item *
 
-If I<tiff_compression> if C<jpeg> then this can be a number from 1 to
-100 giving the JPEG compression quality.  High values are better
-quality and larger files.
+C<tags, tiff_jpegquality>C<tiff_jpegquality> - If C<tiff_compression>
+is C<jpeg> then this can be a number from 1 to 100 giving the JPEG
+compression quality.  High values are better quality and larger files.
 
-=item tiff_resolutionunit
+=item *
 
-The value of the C<ResolutionUnit> tag.  This is ignored on writing if
-the i_aspect_only tag is non-zero.
+X<tags, tiff_resolutionunit>C<tiff_resolutionunit> - The value of the
+C<ResolutionUnit> tag.  This is ignored on writing if the
+i_aspect_only tag is non-zero.
 
 The C<i_xres> and C<i_yres> tags are expressed in pixels per inch no
 matter the value of this tag, they will be converted to/from the value
 stored in the TIFF file.
 
-=item tiff_resolutionunit_name
+=item *
 
-This is set when reading a TIFF file to the name of the unit given by
+X<tags, tiff_resolutionunit_name>C<tiff_resolutionunit_name> - This is
+set when reading a TIFF file to the name of the unit given by
 C<tiff_resolutionunit>.  Possible results include C<inch>,
 C<centimeter>, C<none> (the C<i_aspect_only> tag is also set reading
 these files) or C<unknown>.
 
-=item tiff_bitspersample
-
-Bits per sample from the image.  This value is not used when writing
-an image, it is only set on a read image.
-
-=item tiff_photometric
-
-Value of the C<PhotometricInterpretation> tag from the image.  This
-value is not used when writing an image, it is only set on a read
-image.
-
-=item tiff_documentname
-
-=item tiff_imagedescription
-
-=item tiff_make
-
-=item tiff_model
-
-=item tiff_pagename
+=item *
 
-=item tiff_software
+X<tags, tiff_bitspersample>C<tiff_bitspersample> - Bits per sample
+from the image.  This value is not used when writing an image, it is
+only set on a read image.
 
-=item tiff_datetime
+=item *
 
-=item tiff_artist
+X<tags, tiff_photometric>C<tiff_photometric> - Value of the
+C<PhotometricInterpretation> tag from the image.  This value is not
+used when writing an image, it is only set on a read image.
 
-=item tiff_hostcomputer
+=item *
 
-Various strings describing the image.  tiff_datetime must be formatted
-as "YYYY:MM:DD HH:MM:SS".  These correspond directly to the mixed case
-names in the TIFF specification.  These are set in images read from a
-TIFF and saved when writing a TIFF image.
+C<tiff_documentname>, C<tiff_imagedescription>, C<tiff_make>,
+C<tiff_model>, C<tiff_pagename>, C<tiff_software>, C<tiff_datetime>,
+C<tiff_artist>, C<tiff_hostcomputer> - Various strings describing the
+image.  C<tiff_datetime> must be formatted as "YYYY:MM:DD HH:MM:SS".
+These correspond directly to the mixed case names in the TIFF
+specification.  These are set in images read from a TIFF and saved
+when writing a TIFF image.
 
 =back
 
@@ -957,24 +989,9 @@ some page other than the first.  The page is 0 based:
   $image->read(file=>"example.tif", page=>1)
     or die "Cannot read second page: ",$image->errstr,"\n";
 
-Note: Imager uses the TIFF*RGBA* family of C<libtiff> functions,
-unfortunately these don't support alpha channels on CMYK images.  This
-will result in a full coverage alpha channel on CMYK images with an
-alpha channel, until this is implemented in C<libtiff> (or Imager's TIFF
-implementation changes.)
-
 If you read an image with multiple alpha channels, then only the first
 alpha channel will be read.
 
-Currently Imager's TIFF support reads all direct color images as 8-bit
-RGB images, this may change in the future to reading 16-bit/sample
-images.
-
-Currently tags that control the output color type and compression are
-ignored when writing, this may change in the future.  If you have
-processes that rely upon Imager always producing C<packbits>
-compressed RGB images, you should strip any tags before writing.
-
 =head2 BMP (Windows Bitmap)
 
 Imager can write 24-bit RGB, and 8, 4 and 1-bit per pixel paletted