ioexif

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileExif

type FileExif struct {
	Data map[string]string
}

FileExif data store for exif data

func New

func New() *FileExif

New create a new FilExif store

func (*FileExif) Exif

func (x *FileExif) Exif(fileName string) error

Exif determine all exif meta data attached to file i.e. jpg type

func (*FileExif) ReadALLDataAsJSON

func (x *FileExif) ReadALLDataAsJSON(f *os.File)

ReadALLDataAsJSON read data from exif metadata and set to our datastore

Example
var file = "./textRotate.jpg"

f, err := os.Open(file)
if err != nil {
	log.Println(err)
}
defer f.Close()

d := &FileExif{}

d.Data = make(map[string]string)
//d.ReadALLDataAsJSON(f)		Use to find fields

keys := make([]exif.FieldName, 0)
keys = append(keys, exif.FocalLength)
keys = append(keys, exif.PixelXDimension)
keys = append(keys, exif.PixelYDimension)
keys = append(keys, exif.ExifVersion)
keys = append(keys, exif.ThumbJPEGInterchangeFormat)
keys = append(keys, exif.ThumbJPEGInterchangeFormatLength)
keys = append(keys, exif.Model)
keys = append(keys, exif.Make)
keys = append(keys, exif.Flash)
keys = append(keys, exif.ExposureTime)
keys = append(keys, exif.DigitalZoomRatio)
keys = append(keys, exif.DateTimeOriginal)
keys = append(keys, exif.DateTime)
keys = append(keys, exif.DateTimeDigitized)
err = d.ReadDataByKey(f, keys)
if err != nil {
	log.Printf("ERROR: issue reading by key\n%+v\n", err)
}
//w x h
t := ioimage.NewImageMeta()
w, h, imgtype := t.Dimensions(file)
log.Printf("W: %d, H: %d Type: %s\n", w, h, imgtype)
log.Println("print data found")
for k, v := range d.Data {
	log.Println(k, ":", v)
}

//log.Println(d.JSONData)

//log.Println("")

/*
	Output:
	hi
*/	*/
Output:

		hi

func (*FileExif) ReadDataByKey

func (x *FileExif) ReadDataByKey(f *os.File, key []exif.FieldName) error

ReadDataByKey find data by key exif.FocalLength exif.PixelXDimension exif.PixelYDimension exif.ExifVersion exif.ThumbJPEGInterchangeFormat exif.ThumbJPEGInterchangeFormatLength exif.Model exif.Make exif.Flash exif.ExposureTime exif.DigitalZoomRatio

func (*FileExif) ReadLatLongData

func (x *FileExif) ReadLatLongData(f *os.File)

ReadLatLongData find lat/long data and return

Jump to

Keyboard shortcuts

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