Skip to content

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

Open
@matti777

Description

@matti777

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

Metadata

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