GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - barasher/go-exiftool: Golang wrapper for Exiftool : extract as much metadata as possible (EXIF, ...) from files (pictures, pdf, office documents, ...)

BranchesTags
Open more actions menu

Latest commit

 

History

76 Commits
76 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
testdata
testdata
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.MD
README.MD
 
 
exiftool.go
exiftool.go
 
 
exiftool_sample_test.go
exiftool_sample_test.go
 
 
exiftool_test.go
exiftool_test.go
 
 
filemetadata.go
filemetadata.go
 
 
filemetadata_test.go
filemetadata_test.go
 
 
go.mod
go.mod
 
 
go.sum
go.sum
 
 
platform_darwin.go
platform_darwin.go
 
 
platform_freebsd.go
platform_freebsd.go
 
 
platform_linux.go
platform_linux.go
 
 
platform_windows.go
platform_windows.go
 
 

Repository files navigation

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

  • v1.1.0 : initial release
  • v1.1.1
    • add typed getters for filemetadata fields
  • v1.1.3
    • add Mac & Windows support (thanks to @PROger4ever)
    • increase errors readability (thanks to @PROger4ever)
  • v1.2.0
    • add stdout and stderr buffer configuration capabilities (thank to @asannikov)
  • v1.3.0
    • Add functionnal option to set ExifTool's -charset parameter (thank to @PROger4ever)
  • v1.3.1
    • fix line separator on macOS
  • v1.3.2
    • add Freebsd support (thanks to @ghyman1)
  • v1.4.0
    • "NoPrintConversion" functional option (thanks to Kjeldgaard)
  • v1.5.0
    • "ExtractEmbedded" functional option
  • v1.6.0
    • "ExtractAllBinaryMetadata" functional option
  • v1.6.1
    • "SetExiftoolBinaryPath" functional option : specify where to find exiftool binary (default : $path)
  • v1.6.2
    • Several improvements (thanks to Dale Hui)
  • v1.7.0
    • Add metadata writing capabilities (thanks to Dale Hui)
  • v1.8.0
    • Fix a bug that was blocking go-exiftool when a folder was provided. Folder metadata extraction will now return a new sentinel error (ErrNotFile).
    • Add a new sentinel error (ErrBufferTooSmall) that is returned when go-exiftool's buffer isn't big enough for a specifi file (countermeasure: initialize go-exiftool with the Buffer option)
    • New option to specify a date format (DateFormat) (thanks to Andy Gorman)
    • New option to output format for GPS coordinates (CoordFormat) (thanks to Andy Gorman)
  • v1.9.0
    • New option to specify -api parameter to Exiftool (thanks to Blesmol)
  • v1.10.0
    • New option to prefix metadata keys with group names (specifies -G parameter to Exiftool) (thanks to Andy Gorman)

About

Golang wrapper for Exiftool : extract as much metadata as possible (EXIF, ...) from files (pictures, pdf, office documents, ...)

Topics

exifexiftoolgolangiptcwrapper-api

Resources

Readme
GPL-3.0 license
Activity

Stars

299 stars

Watchers

6 watching

Forks

48 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.