Defining UIImage Color Space

I am wondering if there is an easy way to get the color space of an image (i.e. an image loaded into UIImage)? For example, I have a TIFF image, and I would like to determine if it uses the RGB color space or not. Is there an easy way to do this without manipulating pixel data? I know that there are some CGColorSpace functions, but none of them seem to do this, just create color spaces and manipulate them (and much more complex functions).

Thanks in advance.

+3
source share
1 answer

You need to get the color space through CGImage. You can do this with the following line of functions / properties:

@property(nonatomic, readonly) CGImageRef CGImage

CGColorSpaceRef CGImageGetColorSpace (
   CGImageRef image
);

, , :

CGColorSpaceRef colorspace = CGImageGetColorSpace([myUIImage CGImage]);

, , get/create/copy CG.

+13

Source: https://habr.com/ru/post/1774610/


All Articles