Skip to content

SkEncodedOrigin wrong for one JPEG but not another - why? #1517

@Webreaper

Description

@Webreaper

I have two images (attached) which I'm trying to load, orient correctly, and then resize/crop to make thumbnails. My code to load the codec is super simple (I haven't included the code to resize and rotate, but can do if appropriate):

            SKCodec codec = SKCodec.Create(source.FullName);
            SKImageInfo info = codec.Info;

When I load the code via the Codec, the origin is coming back as 'Default' (TopLeft) for P8211052.JPG, which means that my resized thumbnails are not rotated correctly. However, for PA010741.JPG, the origin is correct, so my rotation code works as expected.

I'm struggling to see what the difference is between the two images; both were taken on an Olympus OMD-EM5 Mk2. If I use other image processing libs to do the same thing (e.g., the AutoOrient method in ImageSharp) it works fine - and the photos display correctly-oriented in MacOS Preview. So I'm wondering if there's either something odd about the photos, or a bug in the Codec (which seems less likely, being JPEG). Any ideas?

I could use ImageSharp - which works - but SkiaSharp can process the thumbnails about 4-6x as fast, which is important as I'm processing hundreds of thousands of images in my app.

P8211052.JPG.zip
PA010741.JPG.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions