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.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 [nl]
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 data types are defined as follows 1 BYTE (8 bit unsigned inte‐
121 ger) 2 ASCII 3 SHORT (16 bit unsigned integer) 4 LONG (32 bit
122 unsigned integer) 5 RATIONAL 6 SBYTE (8 bit signed byte) 7 UNDE‐
123 FINED (uninterpreted binary data) 8 SSHORT (signed 16 bit inte‐
124 ger) 9 SLONG (signed 32 bit integer) 10 SRATIONAL 11 FLOAT (32
125 bit floating point number) 12 DOUBLE (64 bit floating point num‐
126 ber) Throws an error if file is not a TIFF image.
127
128 ::tiff::deleteEntry file entry ?image?
129 Deletes the specified entries from the image named by ?image?
130 (default 0), or optionally all. Throws an error if file is not
131 a TIFF image.
132
133 ::tiff::getImage file ?image?
134 Returns the name of a Tk image containing the image at index
135 ?image? from file Throws an error if file is not a TIFF image,
136 or if image is an unsupported format. Supported formats are
137 uncompressed 24 bit RGB and uncompressed 8 bit palette.
138
139 ::tiff::writeImage image file ?entry?
140 Writes the contents of the Tk image image to a tiff file file.
141 Files are written in the 24 bit uncompressed format, with big
142 endian byte order. Additional entries to be added to the image
143 may be specified, in the same format as tiff::addEntry
144
145 ::tiff::nametotag names
146 Returns a list with names translated from string to 4 digit for‐
147 mat. 4 digit names in the input are passed through unchanged.
148 Strings without a defined tag name will throw an error.
149
150 ::tiff::tagtoname tags
151 Returns a list with tags translated from 4 digit to string for‐
152 mat. If a tag does not have a defined name it is passed through
153 unchanged.
154
155 ::tiff::debug file
156 Prints everything we know about the given file in a nice format.
157
159 The mapping of 4 digit tag names to string names uses the array
160 ::tiff::tiff_tags. The reverse mapping uses the array
161 ::tiff::tiff_sgat.
162
164 cannot write exif ifd reading limited to uncompressed 8 bit rgb and 8
165 bit palletized images writing limited to uncompressed 8 bit rgb
166
168 image, tif, tiff
169
171 Copyright (c) 2005-2006, Aaron Faupell <afaupell@users.sourceforge.net>
172
173
174
175
176tiff 0.1 tiff(n)