1tiff(n) TIFF image manipulation tiff(n)
2
3
4
5______________________________________________________________________________
6
8 tiff - TIFF reading, writing, and querying and manipulation of meta
9 data
10
12 package require Tcl 8.2
13
14 package require tiff ?0.2.1?
15
16 ::tiff::isTIFF file
17
18 ::tiff::byteOrder file
19
20 ::tiff::numImages file
21
22 ::tiff::dimensions file ?image?
23
24 ::tiff::imageInfo file ?image?
25
26 ::tiff::entries file ?image?
27
28 ::tiff::getEntry file entry ?image?
29
30 ::tiff::addEntry file entry ?image?
31
32 ::tiff::deleteEntry file entry ?image?
33
34 ::tiff::getImage file ?image?
35
36 ::tiff::writeImage image file ?entry?
37
38 ::tiff::nametotag names
39
40 ::tiff::tagtoname tags
41
42 ::tiff::debug file
43
44_________________________________________________________________
45
47 This package provides commands to query, modify, read, and write TIFF
48 images. TIFF stands for Tagged Image File Format and is a standard for
49 lossless storage of photographical images and associated metadata. It
50 is specified at http://partners.adobe.com/public/devel‐
51 oper/tiff/index.html.
52
53 Multiple images may be stored in a single TIFF file. The ?image?
54 options to the functions in this package are for accessing images other
55 than the first. Data in a TIFF image is stored as a series of tags hav‐
56 ing a numerical value, which are represented in either a 4 digit hexa‐
57 decimal format or a string name. For a reference on defined tags and
58 their meanings see http://www.awaresystems.be/imaging/tiff/tiff‐
59 tags.html
60
62 ::tiff::isTIFF file
63 Returns a boolean value indicating if file is a TIFF image.
64
65 ::tiff::byteOrder file
66 Returns either big or little. Throws an error if file is not a
67 TIFF image.
68
69 ::tiff::numImages file
70 Returns the number of images in file. Throws an error if file
71 is not a TIFF image.
72
73 ::tiff::dimensions file ?image?
74 Returns the dimensions of image number ?image? in file as a list
75 of the horizontal and vertical pixel count. Throws an error if
76 file is not a TIFF image.
77
78 ::tiff::imageInfo file ?image?
79 Returns a dictionary with keys ImageWidth, ImageLength, BitsPer‐
80 Sample, Compression, PhotometricInterpretation, ImageDescrip‐
81 tion, Orientation, XResolution, YResolution, ResolutionUnit,
82 DateTime, Artist, and HostComputer. The values are the associ‐
83 ated properties of the TIFF ?image? in file. Values may be empty
84 if the associated tag is not present in the file.
85
86 puts [::tiff::imageInfo photo.tif]
87
88 ImageWidth 686 ImageLength 1024 BitsPerSample {8 8 8} Compression 1
89 PhotometricInterpretation 2 ImageDescription {} Orientation 1
90 XResolution 170.667 YResolution 170.667 ResolutionUnit 2 DateTime {2005:12:28 19:44:45}
91 Artist {} HostComputer {}
92
93 There is nothing special about these tags, this is simply a con‐
94 vience procedure which calls getEntry with common entries.
95 Throws an error if file is not a TIFF image.
96
97 ::tiff::entries file ?image?
98 Returns a list of all entries in the given file and ?image? in
99 hexadecimal format. Throws an error if file is not a TIFF
100 image.
101
102 ::tiff::getEntry file entry ?image?
103 Returns the value of entry from image ?image? in the TIFF file.
104 entry may be a list of multiple entries. If an entry does not
105 exist, an empty string is returned
106
107 set data [::tiff::getEntry photo.tif {0131 0132}]
108 puts "file was written at [lindex $data 0] with software [lindex $data 1]"
109
110 Throws an error if file is not a TIFF image.
111
112 ::tiff::addEntry file entry ?image?
113 Adds the specified entries to the image named by ?image?
114 (default 0), or optionally all. entry must be a list where each
115 element is a list of tag, type, and value. If a tag already
116 exists, it is overwritten.
117
118 ::tiff::addEntry photo.tif {{010e 2 "an example photo"} {013b 2 "Aaron F"}}
119
120 The data types are defined as follows
121
122 1 BYTE (8 bit unsigned integer)
123
124 2 ASCII
125
126 3 SHORT (16 bit unsigned integer)
127
128 4 LONG (32 bit unsigned integer)
129
130 5 RATIONAL
131
132 6 SBYTE (8 bit signed byte)
133
134 7 UNDEFINED (uninterpreted binary data)
135
136 8 SSHORT (signed 16 bit integer)
137
138 9 SLONG (signed 32 bit integer)
139
140 10 SRATIONAL
141
142 11 FLOAT (32 bit floating point number)
143
144 12 DOUBLE (64 bit floating point number)
145 Throws an error if file is not a TIFF image.
146
147 ::tiff::deleteEntry file entry ?image?
148 Deletes the specified entries from the image named by ?image?
149 (default 0), or optionally all. Throws an error if file is not
150 a TIFF image.
151
152 ::tiff::getImage file ?image?
153 Returns the name of a Tk image containing the image at index
154 ?image? from file Throws an error if file is not a TIFF image,
155 or if image is an unsupported format. Supported formats are
156 uncompressed 24 bit RGB and uncompressed 8 bit palette.
157
158 ::tiff::writeImage image file ?entry?
159 Writes the contents of the Tk image image to a tiff file file.
160 Files are written in the 24 bit uncompressed format, with big
161 endian byte order. Additional entries to be added to the image
162 may be specified, in the same format as tiff::addEntry
163
164 ::tiff::nametotag names
165 Returns a list with names translated from string to 4 digit for‐
166 mat. 4 digit names in the input are passed through unchanged.
167 Strings without a defined tag name will throw an error.
168
169 ::tiff::tagtoname tags
170 Returns a list with tags translated from 4 digit to string for‐
171 mat. If a tag does not have a defined name it is passed through
172 unchanged.
173
174 ::tiff::debug file
175 Prints everything we know about the given file in a nice format.
176
178 The mapping of 4 digit tag names to string names uses the array
179 ::tiff::tiff_tags. The reverse mapping uses the array
180 ::tiff::tiff_sgat.
181
183 [1] Cannot write exif ifd
184
185 [2] Reading limited to uncompressed 8 bit rgb and 8 bit palletized
186 images
187
188 [3] Writing limited to uncompressed 8 bit rgb
189
191 This document, and the package it describes, will undoubtedly contain
192 bugs and other problems. Please report such in the category tiff of
193 the Tcllib SF Trackers [http://source‐
194 forge.net/tracker/?group_id=12883]. Please also report any ideas for
195 enhancements you may have for either package and/or documentation.
196
198 image, tif, tiff
199
201 Copyright (c) 2005-2006, Aaron Faupell <afaupell@users.sourceforge.net>
202
203
204
205
206tiff 0.2.1 tiff(n)