simpleGoExif

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

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

Go to latest
Published: Jun 7, 2022 License: MIT Imports: 7 Imported by: 0

README

Go Reference

Simple Go Exif

You can implement this github.com/dsoprea/go-exif/v2 in your code and feel pure pain. Otherwise you can use my library. I've simplified it.

Please check out following:

package main

import (
    "fmt"
    "time"
    exif "github.com/Gasoid/simpleGoExif"
)

func main() {
    image, err := exif.Open("image.jpg")
    if err != nil {
        fmt.Println("err:", err.Error())
    }
    defer image.Close()
    image.SetDescription("text")
    image.SetTime(time.Now())
    image.SetGPS(float64(52.5219814), float64(13.4111173))
}

Documentation

Index

Constants

View Source
const (
	ImageDescriptionTag = "ImageDescription"
	DateTimeTag         = "DateTime"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ExifError

type ExifError struct {
	Err error
	// contains filtered or unexported fields
}

func (*ExifError) Error

func (e *ExifError) Error() string

func (*ExifError) Unwrap

func (e *ExifError) Unwrap() error

type Image

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

func Open

func Open(path string) (*Image, error)

Open creates a new Image struct, initializes the EXIF data, and returns the struct Image

func (*Image) Close

func (f *Image) Close() error

Close writes the EXIF data to the file.

func (*Image) GetDescription

func (f *Image) GetDescription() string

GetDescription returns the description of the image.

func (*Image) GetRootIb

func (f *Image) GetRootIb() *exif.IfdBuilder

GetRootIb is a getter for the rootIb.

func (*Image) GetTagValueString

func (f *Image) GetTagValueString(tag string) string

GetTagValueString returns the value of tag. the method works only for string value

func (*Image) GetTime

func (f *Image) GetTime() time.Time

GetTime returns the time of the image.

func (*Image) SetDescription

func (f *Image) SetDescription(description string) error

SetDescription sets the description of the image.

func (*Image) SetGPS

func (f *Image) SetGPS(latitude, longitude float64) error

SetGPS sets the GPS coordinates of the image.

func (*Image) SetTagValueString

func (f *Image) SetTagValueString(tag, val string) error

SetTagValueString sets the value of the given tag. the method sets string value for tag

func (*Image) SetTime

func (f *Image) SetTime(date time.Time) error

SetTime sets the time of the image.

Jump to

Keyboard shortcuts

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