tiff(n)

πŸ“¦
version 2.0 Β· 2 versions
, in fedora 43, fedora 44, nixos 26.05, nixpkgs unstable

tiff(n) β€” TIFF image manipulation πŸŽ€

okay so bestie, you've stumbled into tiff(n), the manual page for TIFF image manipulation in Tcllib, and honestly? it's giving ✨ metadata queen ✨. grab a strawberry πŸ“, sit down, and let's go through it together, because every single detail is staying, no cap.


✨ NAME ✨

tiff β€” TIFF reading, writing, and querying and manipulation of meta data πŸ’…


🌸 SYNOPSIS 🌸

package require Tcl 8.5 9

package require tiff ?0.2.3?

::tiff::isTIFF file

::tiff::byteOrder file

::tiff::numImages file

::tiff::dimensions file ?image?

::tiff::imageInfo file ?image?

::tiff::entries file ?image?

::tiff::getEntry file entry ?image?

::tiff::addEntry file entry ?image?

::tiff::deleteEntry file entry ?image?

::tiff::getImage file ?image?

::tiff::writeImage image file ?entry?

::tiff::nametotag names

::tiff::tagtoname tags

::tiff::debug file

πŸ¦‹ DESCRIPTION πŸ¦‹

so this package hands you the whole toolkit β€” query, modify, read, and write TIFF images. TIFF stands for Tagged Image File Format, and it's a standard for lossless storage of photographical images and their associated metadata. it's specified at

http://partners.adobe.com/public/developer/tiff/index.html

periodt. πŸ“Έ

one single TIFF file can hold multiple images, which is why basically every function here has an optional ?image? argument β€” that's your way in to any image that isn't the first one. and the data inside a TIFF image? stored as a series of tags, each with a numerical value, and each represented either as a 4 digit hexadecimal format or as a string name. if you want a reference on defined tags and what they mean, go here:

http://www.awaresystems.be/imaging/tiff/tifftags.html

iykyk 🧚


πŸ‘‘ COMMANDS πŸ‘‘

  • ::tiff::isTIFF file β€” returns a boolean value telling you if file is a TIFF image. yes or no, iconic behaviour πŸ’…
  • ::tiff::byteOrder file β€” returns either big or little. throws an error if file is not a TIFF image. 🫢
  • ::tiff::numImages file β€” returns the number of images in file. throws an error if file is not a TIFF image. lowkey the most useful count ever.
  • ::tiff::dimensions file ?image? β€” returns the dimensions of image number ?image? in file, as a list of the horizontal and vertical pixel count. throws an error if file is not a TIFF image. πŸ“
  • ::tiff::imageInfo file ?image? β€” returns a dictionary with the keys ImageWidth, ImageLength, BitsPerSample, Compression, PhotometricInterpretation, ImageDescription, Orientation, XResolution, YResolution, ResolutionUnit, DateTime, Artist, and HostComputer. the values are the associated properties of the TIFF ?image? in file. values may be empty if the associated tag isn't present in the file. πŸ’€
puts [::tiff::imageInfo photo.tif]

and the output is giving:

ImageWidth 686 ImageLength 1024 BitsPerSample {8 8 8} Compression 1
PhotometricInterpretation 2 ImageDescription {} Orientation 1
XResolution 170.667 YResolution 170.667 ResolutionUnit 2 DateTime {2005:12:28 19:44:45}
Artist {} HostComputer {}

there is nothing special about these tags, bestie β€” this is simply a convience procedure which calls getEntry with common entries. throws an error if file is not a TIFF image.

  • ::tiff::entries file ?image? β€” returns a list of all entries in the given file and ?image? in hexadecimal format. throws an error if file is not a TIFF image. 🌈
  • ::tiff::getEntry file entry ?image? β€” returns the value of entry from image ?image? in the TIFF file. entry may be a list of multiple entries. if an entry does not exist, an empty string is returned. πŸ“
set data [::tiff::getEntry photo.tif {0131 0132}]
puts "file was written at [lindex $data 0] with software [lindex $data 1]"

throws an error if file is not a TIFF image.

  • ::tiff::addEntry file entry ?image? β€” adds the specified entries to the image named by ?image? (default 0), or optionally all. entry must be a list where each element is a list of tag, type, and value. if a tag already exists, it is overwritten. 😀
::tiff::addEntry photo.tif {{010e 2 "an example photo"} {013b 2 "Aaron F"}}

the data types are defined as follows:

  1. 1 β€” BYTE (8 bit unsigned integer)
  2. 2 β€” ASCII
  3. 3 β€” SHORT (16 bit unsigned integer)
  4. 4 β€” LONG (32 bit unsigned integer)
  5. 5 β€” RATIONAL
  6. 6 β€” SBYTE (8 bit signed byte)
  7. 7 β€” UNDEFINED (uninterpreted binary data)
  8. 8 β€” SSHORT (signed 16 bit integer)
  9. 9 β€” SLONG (signed 32 bit integer)
  10. 10 β€” SRATIONAL
  11. 11 β€” FLOAT (32 bit floating point number)
  12. 12 β€” DOUBLE (64 bit floating point number)

throws an error if file is not a TIFF image.

  • ::tiff::deleteEntry file entry ?image? β€” deletes the specified entries from the image named by ?image? (default 0), or optionally all. throws an error if file is not a TIFF image. bye bye tag 🫢
  • ::tiff::getImage file ?image? β€” returns the name of a Tk image containing the image at index ?image? from file. throws an error if file is not a TIFF image, or if image is an unsupported format. supported formats are uncompressed 24 bit RGB and uncompressed 8 bit palette. 🎨
  • ::tiff::writeImage image file ?entry? β€” writes the contents of the Tk image image to a tiff file file. files are written in the 24 bit uncompressed format, with big endian byte order. additional entries to be added to the image may be specified, in the same format as tiff::addEntry. ✍️
  • ::tiff::nametotag names β€” returns a list with names translated from string to 4 digit format. 4 digit names in the input are passed through unchanged. strings without a defined tag name will throw an error. πŸ’…
  • ::tiff::tagtoname tags β€” returns a list with tags translated from 4 digit to string format. if a tag does not have a defined name it is passed through unchanged. πŸ”
  • ::tiff::debug file β€” prints everything we know about the given file in a nice format. it's giving unhinged infodump and we love that for us. πŸ—£οΈ

πŸ’œ VARIABLES πŸ’œ

the mapping of 4 digit tag names to string names uses the array ::tiff::tiff_tags. the reverse mapping uses the array ::tiff::tiff_sgat. two arrays, one vibe. πŸ‘―


😭 LIMITATIONS 😭

  1. cannot write exif ifd
  2. reading limited to uncompressed 8 bit rgb and 8 bit palletized images
  3. writing limited to uncompressed 8 bit rgb
bestie. read those three again before you start filing bugs. reading and writing are limited, this is not a skill issue on your part, it's just how the package is. πŸ™ˆ

🫢 BUGS, IDEAS, FEEDBACK 🫢

this document, and the package it describes, will undoubtedly contain bugs and other problems. it's not a flaw, it's a lifestyle. πŸ’€ please report such in the category tiff of the Tcllib Trackers at

http://core.tcl.tk/tcllib/reportlist

please also report any ideas for enhancements you may have for either package and/or documentation. we want them, fr fr.

when proposing code changes, please provide unified diffs, i.e the output of diff -u.

note further that attachments are strongly preferred over inlined patches. attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar. that's the whole trick, periodt. ✨


⭐ KEYWORDS ⭐

image, tif, tiff


🌈 CATEGORY 🌈

File formats


Copyright (c) 2005-2006, Aaron Faupell <afaupell@users.sourceforge.net>


okay and that's the whole page, bestie πŸ¦‹ this came to you straight from tcllib, version 0.2.3, and it's the tiff(n) page β€” so go forth, read some tags, write some images, and slay πŸ’…βœ¨πŸ‘‘

πŸ“¦ where this page comes from