tiff

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package tiff reads the tags of the TIFF structure of EXIF data, in a JPEG image or a TIFF image, which libexif doesn't expose, or which are needed without cgo, such as the orientation of an image and its thumbnail

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Data

func Data(data []byte) []byte

Data returns the data from the TIFF header, which is after the EXIF header in a JPEG image, or at the start of a TIFF image or EXIF data, or after the four bytes before the EXIF data of a HEIF image, or nil when there isn't one

func Normalize

func Normalize(data []byte) []byte

Normalize returns the data of a RAW image which is TIFF data with a header of its own, such as an Olympus ORF image, which is IIRO, or a Panasonic RW2 image, which is IIU, with a TIFF header, so it can be read as TIFF data, or the data itself when it has a TIFF header, or nil when it isn't TIFF data

func Orientation

func Orientation(data []byte) int

Orientation returns the orientation of the image, from 1 to 8, as EXIF defines it, which is the transformation to display it (see artwork.Orient), or 1 when it doesn't have one, or it isn't valid

func PaletteAlpha

func PaletteAlpha(data []byte) image.Image

PaletteAlpha returns the image of TIFF data which is an uncompressed palette image, with an alpha channel, with eight bits a sample, as Illustrator writes the preview of an EPS file, which golang.org/x/image/tiff reads as an image with one sample a pixel, or nil when it isn't one. Its tags don't need to be sorted.

func SortTags

func SortTags(data []byte) []byte

SortTags returns a copy of TIFF data whose image file directories have their entries sorted by their tags, as TIFF requires, which some applications don't do, such as Illustrator 8 in the preview of an EPS file, so a decoder which requires it can read it, or the data itself when it doesn't start with a TIFF header

func Thumbnail

func Thumbnail(data []byte) []byte

Thumbnail returns the thumbnail which is embedded in the EXIF data, which is usually a small JPEG image, such as 160x120, or nil when there isn't one, or it's outside the data. It's the data at the offset and with the length of the JPEGInterchangeFormat and JPEGInterchangeFormatLength tags of IFD1, from the TIFF header. It isn't checked that it's an image, as it can be cut short, such as when the image data has been removed.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL