Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Decode PNG image problem #2095

Closed
KyungtackKim opened this issue Jun 2, 2022 · 6 comments
Closed

[BUG] Decode PNG image problem #2095

KyungtackKim opened this issue Jun 2, 2022 · 6 comments

Comments

@KyungtackKim
Copy link

KyungtackKim commented Jun 2, 2022

Description

When decoding a PNG image, some areas of the image crack.

Code

// path = PNG image file path
// get bitmap
using (var bitmap = SKBitmap.Decode(path))
{
    // check image size
    if (bitmap.Info.Width <= 4096 || bitmap.Info.Height <= 4096)
    {
        // get scale information
        var scale = Math.Min(1280.0f / bitmap.Width, 800.0f / bitmap.Height);
        var x = (1280 - scale * bitmap.Width) / 2;
        var y = (800 - scale * bitmap.Height) / 2;
        var rect = new SKRect(x, y, x + scale * bitmap.Width, y + scale * bitmap.Height);
        // draw image
        canvas.DrawBitmap(bitmap, rect,
            new SKPaint { IsAntialias = true, FilterQuality = SKFilterQuality.High });
    }
}

Expected Behavior

Actual Behavior

Basic Information

  • Version with issue: SkiaSharp.Views.WindowsForms v2.88.0
  • Last known good version: SkiaSharp.Views.WindowsForms v2.80.4
  • IDE: Visual studio 2019
  • Platform Target Frameworks: WinForm .NetFramework 4.8
  • Target Devices: Windows 11
Detailed IDE/OS information (click to expand)

PASTE ANY DETAILED VERSION INFO HERE

Screenshots

2022-06-02 11_45_04-Position
( v2.80.4 )

2022-06-02 11_45_49-Position
( v2.88.0 )

Reproduction Link

image file download : https://hantas-my.sharepoint.com/:i:/g/personal/kyungtack_kim_hantas_kr/EX0xZOqr7TlDv6NVZOs4rcYB2i1jZHhxte9U6CfGoweCkg?e=7y0T3X

@mgood7123
Copy link
Contributor

mgood7123 commented Jun 2, 2022

0.0 holy crap

@miszu
Copy link

miszu commented Jun 3, 2022

Noticed similar issues with jpg - interesting fact is that it works fine when running in Xamarin.iOS iPhone simulator environment, but doesn't work in a unit test env (MacBook M1, NET 6.0) - sometimes these random artefacts appear, as posted by @KyungtackKim.

@PhotonSPK
Copy link

this should be fixed at 2.88.1-pre1. have you try it?

@miszu
Copy link

miszu commented Jun 5, 2022

@AkulaKirov I checked and it fixed my issues, thanks a lot! 🙌🏻 Hopefully worked for @KyungtackKim as well.

nyanmisaka added a commit to nyanmisaka/jellyfin that referenced this issue Jun 6, 2022
nyanmisaka added a commit to nyanmisaka/jellyfin that referenced this issue Jun 6, 2022
nyanmisaka added a commit to nyanmisaka/jellyfin that referenced this issue Jun 6, 2022
@miszu
Copy link

miszu commented Jun 14, 2022

Would be awesome to see a hotfix version with this image loading issue fixed - let me know if I can test something more or provide more feedback. We've used the 2.88.1-pre1 since a week and haven't seen any problems 🙌🏻

@KyungtackKim
Copy link
Author

@miszu

Thank you for the update. I am also using 2.88.1-peview.1 and this problem no longer appears.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants