UIImageColors icon indicating copy to clipboard operation
UIImageColors copied to clipboard

Can't work in macOS Catalina

Open GnohiSiaM opened this issue 6 years ago • 2 comments

UIImageColors can get colors of NSImage correctly in Mojave, but always get black and white in Catalina.

GnohiSiaM avatar Dec 02 '19 07:12 GnohiSiaM

I have the same problem, the background color always return black (0 0 0 1)

alberttra avatar Feb 14 '20 15:02 alberttra

@GnohiSiaM @alberttra It's because the code assumes that we're using 32bits per pixel. It seems that the image uses 16-bit floating point per channel (for example, P3 color space). You can always verify it by checking cgImage properties. The best way to handle that problem is to use the Accelerate framework and change the underlying storage for any picture to some common format. It seems that this problem exists only on the Mac but I think it's safe to do so with both UIImage and the NSImage. I have a workaround that works but I'm still working on some details. I'll propose solution later.

rurza avatar Aug 08 '21 16:08 rurza