You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm loading and orienting a CR2 image using the code below. However, whilst ExifTool correctly shows the orientation as: Orientation = Left side, bottom (Rotate 270 CW), SkiaSharp seems to be incorrectly decoding the orientation to SKEncodedOrigin.TopLeft. This means I don't rotate the image, and the thumbnails are rendered incorrectly.
I have a sample image, but it's too large to attach, so I've zipped it and put it in my GDrive folder here:
var codec = SKCodec.Create(source.FullName);
var info = codec.Info;
// get the scale that is nearest to what we want (eg: jpg returned 512)
var supportedScale = codec.GetScaledDimensions((float)desiredWidth / info.Width);
// decode the bitmap at the nearest size
var nearest = new SKImageInfo(supportedScale.Width, supportedScale.Height);
var bmp = SKBitmap.Decode(codec, nearest);
My code then uses codec.EncodedOrigin to auto-orient the image to the right way, before I resize to generate thumbs.
Expected Behavior
I expect the image orientation to be SKEncodedOrigin.LeftBottom which would allow the image to be rotated correctly.
Actual Behavior
The image orientation is evaluated as SKEncodedOrigin.TopLeft, so my code never attempts to rotate.
Version of SkiaSharp
2.88.8 (Current)
Last Known Good Version of SkiaSharp
n/a
IDE / Editor
Rider
Platform / Operating System
.Net 8.0 on Linux, macOS
Platform / Operating System Version
Linux and MacOS
Devices
No response
Relevant Screenshots
Relevant Log Output
No response
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
Description
I'm loading and orienting a CR2 image using the code below. However, whilst ExifTool correctly shows the orientation as:
Orientation = Left side, bottom (Rotate 270 CW)
, SkiaSharp seems to be incorrectly decoding the orientation toSKEncodedOrigin.TopLeft
. This means I don't rotate the image, and the thumbnails are rendered incorrectly.I have a sample image, but it's too large to attach, so I've zipped it and put it in my GDrive folder here:
LV1_3765.CR2.zip
Code
My code then uses
codec.EncodedOrigin
to auto-orient the image to the right way, before I resize to generate thumbs.Expected Behavior
I expect the image orientation to be
SKEncodedOrigin.LeftBottom
which would allow the image to be rotated correctly.Actual Behavior
The image orientation is evaluated as
SKEncodedOrigin.TopLeft
, so my code never attempts to rotate.Version of SkiaSharp
2.88.8 (Current)
Last Known Good Version of SkiaSharp
n/a
IDE / Editor
Rider
Platform / Operating System
.Net 8.0 on Linux, macOS
Platform / Operating System Version
Linux and MacOS
Devices
No response
Relevant Screenshots
Relevant Log Output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: