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
We used SkiaSharp in the Xamarin Android platform to create a bitmap and applied a red background color to specific rectangles. We saved the bitmap as both PNG and JPEG image formats. However, we noticed that the JPEG image displays a different background color than the PNG image. This issue only occurs in Xamarin Android, as the background color displays correctly in both PNG and JPEG formats on Windows. Please check and update details
But, you can also share a short block of code here:
using(varbitmap=new SKBitmap(100,100)){// Create SKCanvas with the bitmapusing(varcanvas=new SKCanvas(bitmap)){// Define rectangle parametersSKRectrectBounds=new SKRect(0,0,100,100);SKPaintpaint=new SKPaint
{Color=new SKColor(255,0,0,255)};// Draw the rectangle on the canvas
canvas.DrawRect(rectBounds, paint);}// Create a MemoryStream to hold the image datavarimageStream=new MemoryStream();
bitmap.Encode(SKEncodedImageFormat.Jpeg,100).SaveTo(imageStream);
imageStream.Position =0;returnimageStream;}
You can also share some XAML:
<!-- xaml code here -->
Expected Behavior
The image's background color should match the PNG.
Description
We used SkiaSharp in the Xamarin Android platform to create a bitmap and applied a red background color to specific rectangles. We saved the bitmap as both PNG and JPEG image formats. However, we noticed that the JPEG image displays a different background color than the PNG image. This issue only occurs in Xamarin Android, as the background color displays correctly in both PNG and JPEG formats on Windows. Please check and update details
Code
The best way to share code for larger projects is a link to a GitHub repository: https://github.com/user/repo/tree/bug-123
But, you can also share a short block of code here:
You can also share some XAML:
<!-- xaml code here -->
Expected Behavior
The image's background color should match the PNG.
Actual Behavior
The Background color should match the PNG image.
Version of SkiaSharp
2.88.6
Last Known Good Version of SkiaSharp
2.88.6
IDE / Editor
Visual Studio (Windows)
Platform / Operating System
Android
Platform / Operating System Version
Android
Devices
Oppo
Relevant Screenshots
https://github.com/mono/SkiaSharp/assets/131945130/dcfff30a-013a-444d-bd05-22e098091a08
Relevant Log Output
Code of Conduct
The text was updated successfully, but these errors were encountered: