apexif

package module
v0.0.0-...-9d52269 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: MIT Imports: 8 Imported by: 0

README

apexif

PkgGoDev

This is a simple Go package for reading EXIF data from various file formats. It's build for speed and simplicity. The package does not have any dependencies.

All data must be loaded in memory (or mmapped) before calling Identify().

Supported file formats
  • CR2
  • CRW
  • HEIC
  • JPEG
  • PNG
  • TIFF
  • WebP
Supported container types
  • ISOBMFF (MPEG-4 Part 12)
  • RIFF
  • TIFF

These are not file formats and only interesting for developers of this package.

Usage example
package main

import (
	"fmt"
	"os"

	"github.com/abrander/apexif"
)

func main() {
	data, err := os.ReadFile("example.jpeg")
	if err != nil {
		panic(err)
	}

	f, err := apexif.Identify(data)
	if err != nil {
		panic(err)
	}

	fmt.Printf("Yay. We got a %s image.\n", f.Name())

	e, err := f.Exif()
	if err != nil {
		panic(err)
	}

	make, _ := e.Make()
	fmt.Printf("The image was captured by a %s camera.\n", make)
}
License

This package is licensed under the MIT license. See LICENSE for details.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Identify

func Identify(data []byte) (fileformats.FileType, error)

Identify tries to identify the file format of the given data. If the file format is recognized, a FileType is returned. If the file format is not recognized, ErrImageNotRecognized is returned.

Types

This section is empty.

Directories

Path Synopsis
containers
cr2
crw
png
tif

Jump to

Keyboard shortcuts

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