Skip to content

ErrUnparseableValue error when reading in a JPEG file taken with a Sony digital camera #80

Open
@matti777

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")
		}
	}

DSC00098

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions