exif

package
v0.73.2 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package exif provides functionality for working with Exif metadata in images.

Index

Constants

View Source
const (
	TagMake         uint16 = 0x010F
	TagModel        uint16 = 0x0110
	TagDateTime     uint16 = 0x0132
	TagExposureTime uint16 = 0x829A
	TagFNumber      uint16 = 0x829D
	TagISOSpeed     uint16 = 0x8827
	TagFocalLength  uint16 = 0x920A
	TagFlash        uint16 = 0x9209
	TagOrientation  uint16 = 0x0112
	TagGPSLatitude  uint16 = 0x0002
	TagGPSLongitude uint16 = 0x0004
	TagGPSAltitude  uint16 = 0x0006
	TagSoftware     uint16 = 0x0131
	TagCopyright    uint16 = 0x8298
	TagArtist       uint16 = 0x013B
	TagDescription  uint16 = 0x010E
	TagUserComment  uint16 = 0x9286
)

Common Exif tag IDs

View Source
const (
	TypeByte      uint16 = 1
	TypeASCII     uint16 = 2
	TypeShort     uint16 = 3
	TypeLong      uint16 = 4
	TypeRational  uint16 = 5
	TypeUndefined uint16 = 7
	TypeSLong     uint16 = 9
	TypeSRational uint16 = 10
)

Common Exif data types

Variables

This section is empty.

Functions

This section is empty.

Types

type Exif

type Exif struct {
	// Common Exif tags
	Make         string    // Camera manufacturer
	Model        string    // Camera model
	DateTime     time.Time // Date and time when the image was taken
	ExposureTime string    // Exposure time (e.g., "1/125")
	FNumber      float64   // F-number (aperture)
	ISOSpeed     uint16    // ISO speed rating
	FocalLength  float64   // Focal length in mm
	Flash        uint16    // Flash status
	Orientation  uint16    // Image orientation
	GPSLatitude  float64   // GPS latitude
	GPSLongitude float64   // GPS longitude
	GPSAltitude  float64   // GPS altitude
	Software     string    // Software used to create the image
	Copyright    string    // Copyright information
	Artist       string    // Artist/author
	Description  string    // Image description
	UserComment  string    // User comment
}

Exif represents Exif metadata in a human-readable format

func FromBytes

func FromBytes(data []byte) (*Exif, error)

FromBytes parses Exif data from a byte array into an Exif struct

func New

func New() *Exif

New creates a new Exif struct with default values

func (*Exif) ToBytes

func (e *Exif) ToBytes() ([]byte, error)

ToBytes converts the Exif struct to a byte array in the correct format

type ExifTag

type ExifTag struct {
	ID    uint16
	Type  uint16
	Value any
}

ExifTag represents a single Exif tag with its value

Jump to

Keyboard shortcuts

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