1This is the README for tif22pnm.c. 2by pts@fazekas.hu at Sun Apr 14 22:56:35 CEST 2002 3Tue Jun 11 18:10:35 CEST 2002 4v0.06 at Mon Oct 7 01:35:40 CEST 2002 5v0.09 at Fri Jan 17 19:38:29 CET 2003 6 7tif22pnm is a command line utility that converts between TIFF sampled images 8and PNM images (both directions), using the libtiff library, but not using 9NetPBM. tif22pnm is similar to tifftopnm utility in the NetPBM distribution, 10but tif22pnm handles a wider range of TIFF files and it is able to output 11the alpha channel as a PBM or PGM file. png22pnm, a converter from PNG to 12PNM is also bundled into the distribution. 13 14Caveat: tiff2pnm v0.07 contains >1000 lines of untested code. The author 15wants to improve the software, and he welcomes bug reports. The author has 16tested v0.07 with around 20 very different input files, and it worked. More 17thorough testing seems to be necessary. 18 19Unique advantages (over any other TIFF to PNM converter): 20 21-- handles all kinds of compressed TIFF files libtiff can cope with 22 (tifftopnm doesn't) 23-- handles all kinds of compressed TIFF files GIMP 1.3 can cope with, plus 24 more (tifftopnm, GIMP 1.3 doesn't) 25-- handles all kinds of color spaces libtiff can cope with 26 (tifftopnm doesn't) 27-- handles TIFF/JPEG input files correctly (tifftopnm doesn't, GIMP 1.0 28 doesn't, xv doesn't, ImageMagick doesn't, GIMP 1.3 does) 29-- automatically writes a smaller file (PBM < PGM < PPM) if image pixels 30 make it possible 31 32Compilation under UNIX 33~~~~~~~~~~~~~~~~~~~~~~ 34 ./configure 35 ./do.sh compile 36 37Compilation under Win32 38~~~~~~~~~~~~~~~~~~~~~~~ 39To compile tif22pnm.exe and png22pnm.exe, the Win32 equivalents of the UNIX 40utilities tif22pnm and png22pnm, you have to install these build 41dependencies first: 42 43-- MinGW and MSYS, available from http://www.mingw.org 44 45-- libz (zlib) for MinGW 46 libjpeg for MinGW 47 libtiff for MinGW 48 libpng for MinGW 49 50 Get them from: 51 52 http://jrfonseca.dyndns.org/projects/gnu-win32/software/ported/index.html 53 http://gnuwin32.sourceforge.net/packages.html 54 http://sourceforge.net/project/showfiles.php?group_id=23617&release_id=63473 55 56 To build a self-contained .exe files, you'll need the appropriate .a 57 files: 58 59 libz.a 60 libpng.a 61 libjpeg.a 62 libtiff.a 63 64 Most of the libraries create only the .dll files properly, and create the 65 .a file that doesn't work without the .dll. To overcome this, watch which 66 commands were used during the build to create the dll, and run `ar cr' to 67 create the .a file manually. For example, recognise the command 68 69 gcc -shared -o libpng.a -Wl,--out-implib,libpng.a -Wl,--enable-auto-image png.o pngerror.o pngget.o pngmem.o pngpread.o pngread.o pngrio.o pngrtran.o pngrutil.o pngset.o pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o -lz 70 71 and execute this afterwards: 72 73 ar cr libpng.a png.o pngerror.o pngget.o pngmem.o pngpread.o pngread.o pngrio.o pngrtran.o pngrutil.o pngset.o pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o 74 75 If the .a file is smaller than the sum of the .o files, or it contains 76 the name of a .dll with a similar name, simply forget about it. Never 77 ever run ranlib! 78 79 Copy *.h to the MinGW directory containing _mingw.h. Copy *.a to the 80 directory containing libcrtdll.a 81 82To build tif22pnm and png22pnm: 83 841. Install all the build dependencies. 85 862. Open the MSYS terminal window from the start menu. 87 883. Run `explorer .' to figure out what is the current working directory. 89 Let's call this directory the MSYS home. 90 914. Download the tif22pnm sources into the MSYS home: 92 93 http://www.inf.bme.hu/~pts/tif22pnm-latest.tar.gz 94 955. Unpack the sources. Run: 96 97 tar xzvf tif22pnm-latest.tar.gz 98 996. Run `cd tif22pnm-*.*' to enter the tif22pnm source directory. It should 100 contain a newer version of this README and the file tif22pnm.c. 101 1027. Run 103 104 export CC='gcc -static' # to build standalone .exe files 105 ./configure 106 107 Verify that both libtiff and libpng are found. If not, examine config.log, 108 and copy the *.a and *.h files from the libraries to a place where gcc 109 will find them. 110 1118. Run 112 113 sh ./do.sh compile 114 1159. The files tif22pnm.exe and png22pnm.exe are now created in the current 116 directory. Use them. You may copy them to another directory right now: 117 118 cp *22pnm.exe 'C:\Program Files' 119 12010. You should invoke *22pnm.exe from the command line (COMMAND.COM or 121 CMD.EXE) with the _appropriate_ arguments, described elsewhere in this 122 document. Don't put it into the Start menu, it won't work (a window will 123 flash in, showing an error message that you haven't supplied the right 124 arguments). 125 12611. The cjpeg.exe and djpeg.exe are useful utilities found in the libjpeg 127 distribution (which you've installed anyway, because libtiff needs it). 128 129Goal 130~~~~ 131The author wants tif22pnm to be able to read a vide range of image formats 132(not just TIFF and PNM), including corrupted image files. In the future 133tif22pnm should support many output formats, but only few compression 134methods. If you want tight output and full PostScript and PDF support, 135please try sam2p: 136 137 http://www.inf.bme.hu/~pts/sam2p/ 138 139Installation 140~~~~~~~~~~~~ 141As root, 142 143 cp tif22pnm /usr/local/bin 144 145Usage 146~~~~~ 147 $ tiff2pnm 148 This is tif22pnm v0.07: TIFF <-> PNM converter, by pts@fazekas.hu 149 Usage: ./tif22pnm [options] [--] in.img [out.img] 150 Options are: 151 -headerdump 152 -rgb opaque RGB, alpha associated to black background (default) 153 -rgbi RGB, ignore alpha 154 -rgba RGB with associated alpha (black background) 155 -rgbu RGB with unassociated alpha 156 -onlya alpha, ignore RGB 157 -text 158 159Legal stuff 160~~~~~~~~~~~ 161This program is free software; you can redistribute it and/or modify 162it under the terms of the GNU General Public License as published by 163the Free Software Foundation; either version 2 of the License, or 164(at your option) any later version. 165 166This program is distributed in the hope that it will be useful, 167but WITHOUT ANY WARRANTY; without even the implied warranty of 168MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 169GNU General Public License for more details. 170 171You should have received a copy of the GNU General Public License 172along with this program; if not, write to the Free Software 173Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 174 175__END__ 176