exiftool

package module
v0.0.0-...-a0e5de1 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2019 License: MIT Imports: 8 Imported by: 4

README

WARNING

I change this library a lot. Don't consider the API stable until a version 1.0 is released

About

go-exiftool makes it easy to extract metadata with exiftool and work with it in Go. There are currently no comparable native Go libraries with the breadth and depth of exiftool. In exchange for functionality there is a bit of a performance and a deployment penalty.

Fortunately, these are minimal. exiftool only requires perl5, which is available by default on almost every platform. The performance overhead of using an external program can be mitigated in many ways (ie: parallel processing). Using Stayopen and Pool helper libraries makes metadata extraction pretty fast. On a 13" 2017 Macbook Pro I was able to extract metadata for 600 images in about 4 seconds.

This library was opensourced so others can not worry about it and just work with the metadata. :)

Notice

This library is still pretty young. Please use and report any bugs and issues.

License

MIT License

Copyright (c) 2017 Benson Wong

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Documentation

Overview

Package exiftool provides golang bindings for calling exiftool and working with the metadata it is able to extract from a media file

Index

Constants

This section is empty.

Variables

View Source
var ErrFilenameInvalid = errors.New("Filename contains control characters")

Functions

func Extract

func Extract(exiftool, filename string, flags ...string) ([]byte, error)

Extract calls a specific exiftool with specific CLI flags

func ExtractReader

func ExtractReader(exiftool string, source io.Reader, flags ...string) ([]byte, error)

ExtractReader extracts EXIF/metadata from an io.Reader, passing data to exiftool via stdin

Types

type Pool

type Pool struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Pool creates multiple stay open exiftool instances and spreads the work across them with a simple round robin distribution.

func NewPool

func NewPool(exiftool string, num int, flags ...string) (*Pool, error)

NewPool creates a *Pool with default flags to pass to every Extract call

func (*Pool) Extract

func (p *Pool) Extract(filename string) ([]byte, error)

func (*Pool) ExtractFlags

func (p *Pool) ExtractFlags(filename string, flags ...string) ([]byte, error)

func (*Pool) Stop

func (p *Pool) Stop()

type Stayopen

type Stayopen struct {
	// contains filtered or unexported fields
}

Stayopen abstracts running exiftool with `-stay_open` to greatly improve performance. Remember to call Stayopen.Stop() to signal exiftool to shutdown to avoid zombie perl processes

func NewStayOpen

func NewStayOpen(exiftool string, flags ...string) (*Stayopen, error)

func (*Stayopen) Extract

func (e *Stayopen) Extract(filename string) ([]byte, error)

Extract calls exiftool on the supplied filename

func (*Stayopen) ExtractFlags

func (e *Stayopen) ExtractFlags(filename string, flags ...string) ([]byte, error)

func (*Stayopen) Stop

func (e *Stayopen) Stop()

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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