Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exif: failed to find exif intro marker #89

Open
eliassama opened this issue Oct 30, 2023 · 1 comment
Open

exif: failed to find exif intro marker #89

eliassama opened this issue Oct 30, 2023 · 1 comment

Comments

@eliassama
Copy link

I need to extract exif from ai generated image.

like this:

5242974a

@eliassama
Copy link
Author

this is my demo

package main

import (
	"fmt"
	"github.com/rwcarlsen/goexif/exif"
	"os"
)

func ReadOrientation(filename string) int {
	file, err := os.Open(filename)
	if err != nil {
		fmt.Println("failed to open file, err: ", err)
		return 0
	}
	defer file.Close()

	x, err := exif.Decode(file)
	if err != nil {
		fmt.Println("failed to decode file, err: ", err)
		return 0
	}

	orientation, err := x.Get(exif.Orientation)
	if err != nil {
		fmt.Println("failed to get orientation, err: ", err)
		return 0
	}
	orientVal, err := orientation.Int(0)
	if err != nil {
		fmt.Println("failed to convert type of orientation, err: ", err)
		return 0
	}

	fmt.Println("the value of photo orientation is :", orientVal)
	return orientVal
}

func main() {
	ReadOrientation("5242974a.png")
}

they report :failed to decode file, err: exif: failed to find exif intro marker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant