tiff

package
v0.0.0-...-93023be Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package tiff implements metadata for TIFF and JPEG image files as defined by XMP Specification Part 1.

Index

Constants

This section is empty.

Variables

View Source
var (
	NsTiff = xmp.NewNamespace("tiff", "http://ns.adobe.com/tiff/1.0/", NewModel)
)

Functions

func NewModel

func NewModel(name string) xmp.Model

Types

type ColorModel

type ColorModel int
const (
	ColorModelWhiteIsZero      ColorModel = 0     // WhiteIsZero
	ColorModelBlackIsZero      ColorModel = 1     // BlackIsZero
	ColorModelRGB              ColorModel = 2     // RGB
	ColorModelRGBPalette       ColorModel = 3     // RGB Palette
	ColorModelTransparencyMask ColorModel = 4     // Transparency Mask
	ColorModelCMYK             ColorModel = 5     // CMYK
	ColorModelYCbCr            ColorModel = 6     // YCbCr
	ColorModelCIELab           ColorModel = 8     // CIELab
	ColorModelICCLab           ColorModel = 9     // ICCLab
	ColorModelITULab           ColorModel = 10    // ITULab
	ColorModelColorFilterArray ColorModel = 32803 // Color Filter Array
	ColorModelPixarLogL        ColorModel = 32844 // Pixar LogL
	ColorModelPixarLogLuv      ColorModel = 32845 // Pixar LogLuv
	ColorModelLinearRaw        ColorModel = 34892 // Linear Raw
)

type CompressionType

type CompressionType int
const (
	CompressionUncompressed CompressionType = 1
	CompressionJPEG         CompressionType = 6
)

type OrientationType

type OrientationType int
const (
	OrientationTopLeft     OrientationType = 1 //  1 = Horizontal (normal)
	OrientationTopRight    OrientationType = 2 //  2 = Mirror horizontal
	OrientationBottomRight OrientationType = 3 //  3 = Rotate 180
	OrientationBottomLeft  OrientationType = 4 //  4 = Mirror vertical
	OrientationLeftTop     OrientationType = 5 //  5 = Mirror horizontal and rotate 270 CW
	OrientationRightTop    OrientationType = 6 //  6 = Rotate 90 CW
	OrientationRightBottom OrientationType = 7 //  7 = Mirror horizontal and rotate 90 CW
	OrientationLeftBottom  OrientationType = 8 //  8 = Rotate 270 CW
)

type PlanarType

type PlanarType int
const (
	PlanarChunky PlanarType = 1 // 1 = chunky
	PlanarPlanar PlanarType = 2 // 2 = planar
)

type ResolutionUnit

type ResolutionUnit int
const (
	ResolutionUnitInches     ResolutionUnit = 2
	ResolutionUnitCentimeter ResolutionUnit = 3
)

type TiffInfo

type TiffInfo struct {
	Artist                    xmp.StringList    `xmp:"dc:creator"`
	BitsPerSample             xmp.IntList       `xmp:"tiff:BitsPerSample"` // 3 components
	Compression               CompressionType   `xmp:"tiff:Compression"`
	DateTime                  xmp.Date          `xmp:"xmp:ModifyDate"`
	ImageLength               int               `xmp:"tiff:ImageLength"`
	ImageWidth                int               `xmp:"tiff:ImageWidth"` // A. Tags relating to image data structure
	Make                      string            `xmp:"tiff:Make"`
	Model                     string            `xmp:"tiff:Model"`
	Software                  string            `xmp:"xmp:CreatorTool"`
	ImageDescription          xmp.AltString     `xmp:"dc:description"`
	Copyright                 xmp.AltString     `xmp:"dc:rights"`
	Orientation               OrientationType   `xmp:"tiff:Orientation"`
	PhotometricInterpretation ColorModel        `xmp:"tiff:PhotometricInterpretation"`
	PlanarConfiguration       PlanarType        `xmp:"tiff:PlanarConfiguration"`
	PrimaryChromaticities     xmp.RationalArray `xmp:"tiff:PrimaryChromaticities"` // 6 components
	ReferenceBlackWhite       xmp.RationalArray `xmp:"tiff:ReferenceBlackWhite"`   // 6 components
	ResolutionUnit            ResolutionUnit    `xmp:"tiff:ResolutionUnit"`        // 2 = inches, 3 = centimeters
	SamplesPerPixel           int               `xmp:"tiff:SamplesPerPixel"`
	TransferFunction          xmp.IntList       `xmp:"tiff:TransferFunction"` // C. Tags relating to image data characteristics
	WhitePoint                xmp.RationalArray `xmp:"tiff:WhitePoint"`
	XResolution               xmp.Rational      `xmp:"tiff:XResolution"`
	YCbCrCoefficients         xmp.RationalArray `xmp:"tiff:YCbCrCoefficients"` // 3 components
	YCbCrPositioning          YCbCrPosition     `xmp:"tiff:YCbCrPositioning"`
	YCbCrSubSampling          YCbCrSubSampling  `xmp:"tiff:YCbCrSubSampling"`
	YResolution               xmp.Rational      `xmp:"tiff:YResolution"`
	NativeDigest              string            `xmp:"tiff:NativeDigest,omit"` // ignore according to spec

	// be resilient to broken writers: read tags erroneously
	// mapped to the wrong XMP properties, but do not output them
	// when writing ourselves
	X_Artist           string        `xmp:"tiff:Artist,omit"`
	X_DateTime         xmp.Date      `xmp:"tiff:DateTime,omit"`
	X_Software         string        `xmp:"tiff:Software,omit"`
	X_ImageDescription xmp.AltString `xmp:"tiff:ImageDescription,omit"`
	X_Copyright        xmp.AltString `xmp:"tiff:Copyright,omit"`
}

func FindModel

func FindModel(d *xmp.Document) *TiffInfo

func MakeModel

func MakeModel(d *xmp.Document) (*TiffInfo, error)

func (TiffInfo) Can

func (x TiffInfo) Can(nsName string) bool

func (*TiffInfo) CanTag

func (x *TiffInfo) CanTag(tag string) bool

func (*TiffInfo) GetTag

func (x *TiffInfo) GetTag(tag string) (string, error)

func (TiffInfo) Namespaces

func (x TiffInfo) Namespaces() xmp.NamespaceList

func (*TiffInfo) SetTag

func (x *TiffInfo) SetTag(tag, value string) error

func (*TiffInfo) SyncFromXMP

func (x *TiffInfo) SyncFromXMP(d *xmp.Document) error

func (*TiffInfo) SyncModel

func (x *TiffInfo) SyncModel(d *xmp.Document) error

func (TiffInfo) SyncToXMP

func (x TiffInfo) SyncToXMP(d *xmp.Document) error

also remap X_* attributes to the correct standard positions, but don't overwrite

type YCbCrPosition

type YCbCrPosition int
const (
	YCbCrPositionCentered YCbCrPosition = 1
	YCbCrPositionCoSited  YCbCrPosition = 2
)

type YCbCrSubSampling

type YCbCrSubSampling xmp.IntList

func (YCbCrSubSampling) IsZero

func (x YCbCrSubSampling) IsZero() bool

func (YCbCrSubSampling) MarshalXMP

func (x YCbCrSubSampling) MarshalXMP(e *xmp.Encoder, node *xmp.Node, m xmp.Model) error

func (YCbCrSubSampling) String

func (x YCbCrSubSampling) String() string

[2, 1] = YCbCr4:2:2 [2, 2] = YCbCr4:2:0

func (YCbCrSubSampling) Typ

func (x YCbCrSubSampling) Typ() xmp.ArrayType

func (*YCbCrSubSampling) UnmarshalXMP

func (x *YCbCrSubSampling) UnmarshalXMP(d *xmp.Decoder, node *xmp.Node, m xmp.Model) error

Jump to

Keyboard shortcuts

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