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
Dropdown doesn't have our version so here goes:
Occurs on: SkiaSharp 2.88.6
Last good: Unknown
The title pretty much describes the issue, could also be related to the other ticket regarding SKColorType.Gray8 considering sampling the image implies it needs to decode the image aswell.
Workaround for anyone who needs it, don't access the source image but call it on SKImage.Create(sourceImage.Info.WithColorType(someOtherColorType) and use that as your sampling source.
Code
Example method, obviously neither GetTrimmingRect() (get trimmable area) or ToSKStream() (wrapper for SKStream with disposeunderlying false) are part of Skia but these methods have been tested with ungodly amounts of throughput already.
/// <inheritdoc/>publicStreamTrimImageBorders(StreamimageStream){usingvarheaders=SKCodec.Create(imageStream.ToSKStream());usingvarsourceImage=SKImage.FromEncodedData(imageStream.ToSKStream());usingvarsourceBitmap=SKBitmap.FromImage(sourceImage);vartrimmingRect=GetTrimmingRect(sourceBitmap);// In the unlikely event of a bug, ensure the rectangle can never be greater than the sourceRecttrimmingRect.Intersect(sourceImage.Info.Rect);// If no trimming would occur, return the original stream seeked to startif(trimmingRect==sourceImage.Info.Rect){imageStream.Seek(0,SeekOrigin.Begin);returnimageStream;}usingvartrimmedImage=sourceImage.Subset(trimmingRect);usingvartrimmedData=trimmedImage.Encode(headers.EncodedFormat,100);// Results in null when source has SKColorType.Gray8varmemStream=newMemoryStream();trimmedData.AsStream().CopyTo(memStream);imageStream.Seek(0,SeekOrigin.Begin);memStream.Seek(0,SeekOrigin.Begin);returnmemStream;}
Expected Behavior
Image is Encoded correctly correctly
Skia obviously has the ability to decode Gray8 as sampling the image with another SKColorType that maps the correct bitstep works just fine so i'd expect this is some internal logic glitchy or the source image isn't what it claims to be and isn't self-evidently obvious to me from reviewing the input source data
Actual Behavior
Unable to Encode or otherwise sample an image with Gray8 as it's SKColorType
Version of SkiaSharp
Other (Please indicate in the description)
Last Known Good Version of SkiaSharp
Other (Please indicate in the description)
IDE / Editor
Visual Studio (Windows)
Platform / Operating System
Linux, Windows
Platform / Operating System Version
Ubuntu 22.04 running in Docker environment with native assets:
Relevant logs have far too much sensitive information to effectively sanitize sorry.
The StackTrace consists essentially just of the code that has the comment for this issue being null
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
Description
Dropdown doesn't have our version so here goes:
Occurs on: SkiaSharp 2.88.6
Last good: Unknown
The title pretty much describes the issue, could also be related to the other ticket regarding SKColorType.Gray8 considering sampling the image implies it needs to decode the image aswell.
Workaround for anyone who needs it, don't access the source image but call it on SKImage.Create(sourceImage.Info.WithColorType(someOtherColorType) and use that as your sampling source.
Code
Example method, obviously neither
GetTrimmingRect() (get trimmable area)
orToSKStream() (wrapper for SKStream with disposeunderlying false)
are part of Skia but these methods have been tested with ungodly amounts of throughput already.Expected Behavior
Image is Encoded correctly correctly
Skia obviously has the ability to decode Gray8 as sampling the image with another SKColorType that maps the correct bitstep works just fine so i'd expect this is some internal logic glitchy or the source image isn't what it claims to be and isn't self-evidently obvious to me from reviewing the input source data
Actual Behavior
Unable to Encode or otherwise sample an image with Gray8 as it's SKColorType
Version of SkiaSharp
Other (Please indicate in the description)
Last Known Good Version of SkiaSharp
Other (Please indicate in the description)
IDE / Editor
Visual Studio (Windows)
Platform / Operating System
Linux, Windows
Platform / Operating System Version
Ubuntu 22.04 running in Docker environment with native assets:
<PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="2.88.6" />
Devices
Any running the above docker image with this code
Relevant Screenshots
Relevant Log Output
Relevant logs have far too much sensitive information to effectively sanitize sorry. The StackTrace consists essentially just of the code that has the comment for this issue being null
Code of Conduct
The text was updated successfully, but these errors were encountered: