SkiaSharp icon indicating copy to clipboard operation
SkiaSharp copied to clipboard

[BUG] SKBitmap.ColorSpace is always null. Unable to check for CMYK, RGB, etc.

Open dsyno opened this issue 1 year ago • 3 comments

Description

Our code needs to check whether an image is CMYK or RGB (and reject any image that is CMYK).

However, @mattleibow "explicitly set the color space to null for backwards compatibility". That is breaking things, since it now seems to be impossible (without jumping through major hoops) to check whether an image is CMYK or not.

Solution: Allow ColorSpace to return the correct value. Or provide another method for checking the color space.

Code

SKBitmap.ColorSpace

Expected Behavior

SKBitmap.ColorSpace should return correct value, instead of null.

Actual Behavior

SKBitmap.ColorSpace always returns null.

Version of SkiaSharp

2.88.3 (Current)

Last Known Good Version of SkiaSharp

Other (Please indicate in the description)

IDE / Editor

Visual Studio (Windows)

Platform / Operating System

All

Platform / Operating System Version

All

Devices

All

Relevant Screenshots

No response

Relevant Log Output

No response

Code of Conduct

  • [x] I agree to follow this project's Code of Conduct

dsyno avatar Apr 27 '24 15:04 dsyno

We could remove that for 3.0.

You could use SKImage as well - or use SKCodec directly and SKBitmap.Decode. That will not remove the colorspace.

mattleibow avatar Apr 29 '24 14:04 mattleibow

I just checked 3.0 and that already has the comapt line removed. Have you tried 3.x at all?

mattleibow avatar May 31 '24 16:05 mattleibow

I just checked 3.0 and that already has the comapt line removed. Have you tried 3.x at all?

I haven't because 3.0 is still in a preview release. We can try it once 3.0 becomes a stable version.

Any ETA for a 3.0 stable?

dsyno avatar May 31 '24 17:05 dsyno