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

Thumbnail offset gets corrupted when updating a tag #70

Open
vinser opened this issue Oct 28, 2022 · 1 comment · May be fixed by #86
Open

Thumbnail offset gets corrupted when updating a tag #70

vinser opened this issue Oct 28, 2022 · 1 comment · May be fixed by #86

Comments

@vinser
Copy link

vinser commented Oct 28, 2022

Hi,
This trivial code corrupts thumbnail

package main

import (
	"log"
	"os"

	exifkniferead "github.com/dsoprea/go-exif-knife/handler/read"
	exifknifewrite "github.com/dsoprea/go-exif-knife/handler/write"
)

func main() {
	inPath := os.Args[1]
	outPath := os.Args[2]

	readExifTag(inPath)
	writeExifTag(inPath, outPath)
	readExifTag(outPath)
}

func readExifTag(inPath string) {

	er := new(exifkniferead.ExifRead)

	err := er.Read(inPath, false, "", []string{"DateTimeOriginal"}, false, false, true)
	fatalIf(err)
}

func writeExifTag(inPath, outPath string) {
	ew := new(exifknifewrite.ExifWrite)

	err := ew.Write(inPath, []string{"IFD/Exif,DateTimeOriginal,2021:10:26 00:00:00"}, outPath)
	fatalIf(err)
}

func fatalIf(err error) {
	if err != nil {
		log.Fatal(err)
	}
}

Source image - jpeg_in
exiftool output before - exif_in.txt
Updated image - jpeg_out
exiftool output after - exif_out.txt - HERE you can see corruptions

Thanks !

@vinser
Copy link
Author

vinser commented Oct 31, 2022

I get the same result when using in package assets/image.jpg

@sdkawata sdkawata linked a pull request Mar 15, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant