'''1. Introduction''' Due to the need to get rid of libtiff, I needed to write tiff images without it and started to write a simple tiff RGB image writer in tcl using the tiff v6.0 specification documentation. Afterwards I transfered the functionality into C++ and I was happy to have no libtiff anymore. The reasons to get rid of libtiff were, that we only needed to write tiff RGB images and that we have 5 platforms to support - 4 UNIX platforms with 32/64bit, ... - so we don't wanted to built more external libraries than needed. The tiff package provides following functionality: tiff2raw: this proc reads a TIFF image file, returns its image file header, its first image file directory containing all needed information to handle the returned raw data from the TIFF image file. The raw data is not decompressed or decoded. So if a LZW compressed TIFF image file is read, the raw data contains the LZW data. "all needed information" must be read carefully, because tiled images are not supported and even TIFF JPEG image files contains some en/decode information the package don't read yet. The returned raw data is a list of all strips read from the TIFF image file. raw2tiff: this proc takes raw data, the width, height, horizontal and vertical resolution, a description to write a TIFF uncompressed RGB image file. So the raw data must be plain RGB data. All RGB data will be written into one strip. dumpTiff: this proc dumps a TIFF image file by writing the information from the image file header and the first image file directory to a channel or a file. Optional the proc saves the raw data into a file too. photo2raw: this proc converts data given by the data command of a tk image (type photo) object into plain RGB data. photo2tiff: this proc converts a given image (type photo) into a TIFF uncompressed RGB image file, using the given description and the horizontal and vertical resolution. tiff2photo: this proc converts if possible a TIFF image file into a tk image (type photo) object. Only uncompressed RGB, RGB palette, Grayscaled and Black/White image files are accepted. '''2. Description''' '''2.1 tiff2raw''' '''Syntax''' tiff2raw fileName ifhVar ifdVar ?bufferVar? fileName: path to the TIFF image file with extension ifhVar: image file header array variable to contain all per header element an array element with the corresponding value/information. ifdVar: image file directory array variable to contain all read directory entries describing the TIFF image file or respectively the raw data belonging to this first image file directory of the TIFF image file bufferVar: the variable to contain the raw data, a list of strips, referenced by the first image file directory '''Details''' 1. in the image file header array variable are only stored following elements: * '''byteOrder''' contains "MM" (big endian) or "II" (little endian) * '''version''' contains 42 (always) * '''ifd.offset''' contains the offset inside the TIFF image file to the first image file directory (ifd) 1. a TIFF image file can store multiple pages, images or image extending data like alpha channel or transparency data. The proc '''tiff2raw''' only supports the first image file directory and extracts only raw data referenced by this image file directory! 1. the image file directory array variable elements are named like following: * if the image file directory entry has a known tag (identifier) its known name will be used * if the tag is not known, the tag value (integer) will be used as array element identifier 1. the data belonging to a image file directory entry is a list collecting following data: * the value of the image file directory entry - may be a list, binary, ASCII or numerical data * the type of the image file directory entry - may be Byte, Ascii, Short, Long, Rational (two Longs), SByte, Undefined, SShort, SLong, SRational, Float or Double * the count of values belonging to the image file directory * the offset to the values of the image file directory - may be "" (extracted from the image file directory), (a calculated value, not directly extracted from the file) or the offset in the format "0x.../..." (hexadecimal / decimal)