Open
Description
Im getting an ErrUnparseableValue error when reading the EXIF of a JPEG image taken with a Sony digital camera. Is that expected, what is the workaround? I would rather not toss away the existing EXIF, instead just be able to skip any unrecognized tags.
Image included as attachment; I am using the below code to read it:
goexif "github.com/dsoprea/go-exif/v3"
goexifundefined "github.com/dsoprea/go-exif/v3/undefined"
jpeg "github.com/dsoprea/go-jpeg-image-structure/v2"
"github.com/pkg/errors"
parser := jpeg.NewJpegMediaParser()
mediaCtx, err := parser.ParseFile(filepath)
if err != nil {
return 0, errors.Errorf("failed to parse JPEG file: %v", err)
}
sl := mediaCtx.(*jpeg.SegmentList)
rootIb, err := sl.ConstructExifBuilder()
if err != nil {
if errors.Is(err, goexifundefined.ErrUnparseableValue) {
// TODO create EXIF from scratch?
log.Printf("No EXIF data, creating it from scratch: rootIb: %v, err: %v", rootIb, err)
} else {
return 0, errors.Wrap(err, "Failed to construct EXIF builder")
}
}
Metadata
Assignees
Labels
No labels
Activity