123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- +----------------------------------------------------------------------+
- | tiff2png - converts a Tagged Image File Format (TIFF) file into |
- | a Portable Network Graphics (PNG) file |
- | |
- | Copyright 1996,2000 Willem van Schaik, Singapore (willem@schaik.com) |
- | Copyright 1999-2002 Greg Roelofs (newt@pobox.com) |
- | |
- +----------------------------------------------------------------------+
- This is the first attempt for a tiff2png program. Reason to develop
- it was the lack of conversion possibilities for TIFF files containing
- alpha channels.
- Especially NeXT users create lots of TIFF files that have the rather
- exceptional 2-bit gray and 4-bit color formats, where both can have
- an alpha channel besides the graphics info. Because PBMplus is not
- supporting alpha, that path "tifftopnm <file> | pnmtopng > <file>"
- makes that the alpha and transparency gets lost.
- I have chosen to use PNG formats as similar as possible to the
- format of the original TIFF file. Thus, paletted TIFF files will be
- converted into PNG files with color-type 3 (= paletted). Only for
- some cased the bit-depth had to be altered to accommodate both
- standards.
- At this moment the program supports grayscale images, full-color RGB
- images, and colormapped (palette) images. This is all in 1 to 16 bits
- per sample (i.e., up to 64-bit RGBA). The compression is as good as
- or better than libtiff is, which is pretty OK. I also implemented
- support for both single-image-planes as well as separated-color-planes.
- Support for so-called tiled images I have left out, for the time being.
- [partial support for tiled images added as of version 0.9]
- Major headaches were the PhotometricInterpretation parameters
- "min-is-white" and "min-is-black". I couldn't yet figure it out for
- 100%, but I suspect incompatibilities between older (netpbm) version
- 2.4 of libtiff and the later v3.x. The "-invert" option is available
- in case there are still problems with some images.
- The major decoding and coding work is done by the libtiff, libpng, and
- zlib libraries; newer versions of libtiff can optionally use libjpeg,
- as well. So you need to get those as well. The latest versions of
- libtiff can be found here:
- http://www.libtiff.org/
- Older versions may still exist here:
- ftp://ftp.sgi.com/graphics/tiff/tiff-v3.4-tar.gz
- ftp://ftp.x.org/R5contrib/netpbm-1mar1994.tar.gz [contains 2.4]
- libpng and zlib may be found at these sites:
- http://www.libpng.org/pub/png/libpng.html
- http://www.zlib.org/
- or here:
- ftp://swrinde.nde.swri.edu/pub/png/src/ (libpng* or lpng*, and zlib*)
- libjpeg is available here:
- http://www.ijg.org/
- ftp://ftp.uu.net/graphics/jpeg/
- To build, first make zlib, libpng, libjpeg, and libtiff according to
- their build instructions. Then edit the tiff2png makefile so that the
- locations of the libraries are correct, and type "make". A separate
- archive, tiff2png-images.zip, contains some test files; the included
- script Alpha.sh will convert all of the TIFFs, overwriting the PNGs at
- the same time. :-) If you have a web browser with adequate alpha support
- (see http://www.libpng.org/pub/png/pngapbr.html for info and links),
- you can test the results by loading Alpha.html in your browser and see
- what happens when you change the background color of the page.
- I also tested this utility against the test pictures at ftp.sgi.com.
- With the exception of the tiled images (not retested since support for
- tiled images was added in tiff2png 0.9), the results were good. But
- there can and will still be many TIFF files that don't convert correctly.
- Please send Greg a copy if you come across such a beast--as long as
- it's not multi-megabytes in size!
-
- For the time being I concentrated on straightforward support of as
- many formats as possible. Future plans are to create PNG chunks for
- all those informational fields that TIFF also contains, like Name,
- Date, Position, Resolution, etc. A somewhat bolder plan is to
- convert the ColorResponseCurves field into PNG gamma/chromaticity
- or iCCP chunks. We'll see. At the moment there is a command-line
- parameter to add a gamma chunk to your PNG file; if you know what
- color space the image pixels are in (e.g., sRGB -> gamma 1/2.2 =
- 0.45455), you can (and should!) add this information to the PNG
- file(s).
- The tiff2png web page is here:
- http://www.libpng.org/pub/png/apps/tiff2png.html
- Willem's home page is here:
- http://www.schaik.com/
- Please send bug reports to Greg Roelofs (newt@pobox.com) and thanks
- to Willem (willem@schaik.com).
- Greg Roelofs
- newt@pobox.com
|