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] SKBitmap.ScalePixels - image downsizing. Quality regression. #3159

Open
1 task done
paratype-fonts opened this issue Feb 8, 2025 · 0 comments
Open
1 task done
Labels

Comments

@paratype-fonts
Copy link

paratype-fonts commented Feb 8, 2025

Description

Bitmap downsizing using SKBitmap.ScalePixels in version 3.116.1 produces images of a larger size and of a lower quality compared to version 2.88.9

Original image (1440X720): https://ptdt.azureedge.net/data/test/large.png
Resized using v2.88.9 (480X240): https://ptdt.azureedge.net/data/test/small_v2.webp
Resized using v3.116.1 (480X240): https://ptdt.azureedge.net/data/test/small_v3.webp

Code

// version 2.88.9
bitmapSrc.ScalePixels(bitmapDst, SKFilterQuality.High);
skDataWebp = bitmapDst.Encode(SKEncodedImageFormat.Webp, 75); // convert to webp format

// version 3.116.1 - SKFilterQuality is obsolete
// use SKSamplingOptions variant equivalent to SKFilterQuality.High
SKSamplingOptions samplingOptions = new SKSamplingOptions(resampler: SKCubicResampler.Mitchell);
bitmapSrc.ScalePixels(bitmapDst, samplingOptions);
skDataWebp = bitmapDst.Encode(SKEncodedImageFormat.Webp, 75); // convert to webp format

Expected Behavior

The downsized image is expected to be of the same quality and size.

Actual Behavior

The downsized image is larger and of inferior quality.

Version of SkiaSharp

3.116.0 (Current)

Last Known Good Version of SkiaSharp

2.88.9 (Previous)

IDE / Editor

Visual Studio (Windows), Visual Studio Code (macOS)

Platform / Operating System

Windows, Mac Catalyst

Platform / Operating System Version

Windows 11 24H2, macOS 15.1.1

Devices

Desktop

Relevant Screenshots

Original image (1440X720): https://ptdt.azureedge.net/data/test/large.png
Resized using v2.88.9 (480X240): https://ptdt.azureedge.net/data/test/small_v2.webp
Resized using v3.116.1 (480X240): https://ptdt.azureedge.net/data/test/small_v3.webp

Relevant Log Output

Code of Conduct

  • I agree to follow this project's Code of Conduct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: New
Development

No branches or pull requests

1 participant