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

Issue with ICC Profile Loss in .Resize() Function - Version 2.88.0 #2629

Closed
1 task done
IAMManuel opened this issue Sep 22, 2023 · 4 comments
Closed
1 task done

Issue with ICC Profile Loss in .Resize() Function - Version 2.88.0 #2629

IAMManuel opened this issue Sep 22, 2023 · 4 comments
Labels

Comments

@IAMManuel
Copy link

Description

We have encountered an issue with the .Resize() function in our software. It appears that, starting from version 2.88.0, images lose their ICC profile after passing through this function. Prior to version 2.88.0, this functionality was working as expected, including in version 2.80.4 and earlier.

Code

We're using images on this site. All the test cases were negatives using the "newer" versions

using SkiaSharp;

try
{
    // Load an image with an ICC profile
    using SKBitmap originalImage = SKBitmap.Decode("pathToImage.jpg");

    // Resize the image
    int newWidth = 200;
    int newHeight = 200;

    // Resize the original image using SkiaSharp
    using SKBitmap skiaResizedBitmap = originalImage.Resize(new SKImageInfo(newWidth, newHeight), SKFilterQuality.High);

    var ms = new MemoryStream();
    skiaResizedBitmap.Encode(ms, SKEncodedImageFormat.Png, 100);
    ms.Position = 0;
    File.WriteAllBytes("resized_image.jpg", ms.ToArray());
}
catch (Exception ex)
{
    Console.WriteLine("An error occurred: " + ex.Message);
}

Expected Behavior

All ICC tests cases should be positives when resizing with SkiaSharp.

Actual Behavior

All ICC test cases are actually negatives when using .Resize() with SkiaSharp

Version of SkiaSharp

2.88.3 (Current)

Last Known Good Version of SkiaSharp

2.80.x (Deprecated)

IDE / Editor

Other (Please indicate in the description)

Platform / Operating System

Windows

Platform / Operating System Version

No response

Devices

No response

Relevant Screenshots

No response

Relevant Log Output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@TommiGustafsson-HMP
Copy link

Here's a duplicate of this issue, which was resolved and closed:
#2784

@IAMManuel
Copy link
Author

After adding the color space, like mention in the issue #2784, I still got an image not respecting the ICC profile again.

@IAMManuel
Copy link
Author

Since we still got the same issues, I've prepared 4 solutions ( 2 with .png and 2 with .jpg images). One used the 2.80.2 version and the other used the 2.88.8 version ( it could be any version later than 2.80.4). They both use the same code expressed in the following issue #2784.

Here are the result images:

  • For the .png using the the 2.80.2 version
    result-picture-icc-embedded-matrix
  • For the .png using the the 2.88.8 version
    result-picture-icc-embedded-matrix
  • For the .jpg using the the 2.80.2 version
    result-picture-icc-embedded-matrix
  • For the .jpg using the the 2.88.8 version
    result-picture-icc-embedded-matrix

For reference, here's the original images:

  • png
    picture-icc-embedded-matrix
  • jpg
    picture-icc-embedded-matrix

And the code that test these cases:
SkiaWorkingPngSample.zip
SkiaNonWorkingPngSample.zip
SkiaWorkingJpegSample.zip
SkiaNonWorkingJpegSample.zip

@IAMManuel
Copy link
Author

After more verification on our part, we found that the issue was on our end. Sorry again for the time taken !

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

No branches or pull requests

2 participants