MCPcopy Index your code
hub / github.com/barasher/go-exiftool

github.com/barasher/go-exiftool @v1.10.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.10.0 ↗ · + Follow
85 symbols 426 edges 9 files 29 documented · 34% 3 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

go-exiftool

Mentioned in Awesome Go Build Status go report card GoDoc codecov

go-exiftool is a golang library that wraps ExifTool.

ExifTool's purpose is to extract and update as much metadata as possible (EXIF, IPTC, XMP, GPS, ...) from a lots of differents file types (Office documents, pictures, movies, PDF, ...).

go-exiftool uses ExifTool's stay_open feature to optimize performance.

Requirements

go-exiftool needs ExifTool to be installed.

  • On Debian : sudo apt-get install exiftool

By default, go-exiftool binary will look for exiftool binary in $PATH, but another location can be specified (see SetExiftoolBinaryPath functional option).

Usage

Metadata extraction

et, err := exiftool.NewExiftool()
if err != nil {
    fmt.Printf("Error when intializing: %v\n", err)
    return
}
defer et.Close()

fileInfos := et.ExtractMetadata("testdata/20190404_131804.jpg")

for _, fileInfo := range fileInfos {
    if fileInfo.Err != nil {
        fmt.Printf("Error concerning %v: %v\n", fileInfo.File, fileInfo.Err)
        continue
    }

    for k, v := range fileInfo.Fields {
        fmt.Printf("[%v] %v\n", k, v)
    }
}

Output :

[FOV] 69.4 deg
[Orientation] Rotate 90 CW
[ColorSpace] sRGB
[Compression] JPEG (old-style)
[YCbCrSubSampling] YCbCr4:2:2 (2 1)
[Aperture] 1.7
[ColorComponents] 3
[SubSecCreateDate] 2019:04:04 13:18:03.0937
[FileSize] 26 kB
[FileAccessDate] 2019:05:17 22:44:26+02:00
[DateTimeOriginal] 2019:04:04 13:18:03
[CreateDate] 2019:04:04 13:18:03
(...)

Metadata update

See example function ExampleExiftool_Write in exiftool_sample_test.go

Changelog

Core symbols most depended-on inside this repo

Close
called by 40
exiftool.go
NewExiftool
called by 37
exiftool.go
ExtractMetadata
called by 30
exiftool.go
GetString
called by 22
filemetadata.go
SetString
called by 10
filemetadata.go
EmptyFileMetadata
called by 10
filemetadata.go
WriteMetadata
called by 6
exiftool.go
GetInt
called by 6
filemetadata.go

Shape

Function 65
Method 17
Struct 3

Languages

Go100%

Modules by API surface

exiftool_test.go36 symbols
exiftool.go19 symbols
filemetadata.go16 symbols
filemetadata_test.go11 symbols
exiftool_sample_test.go3 symbols

Used by 3 indexed graphs manifest dependencies, hub-wide

For agents

$ claude mcp add go-exiftool \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page