cgcolorspace

Determining the Colorspace of a UIImage

吃可爱长大的小学妹 提交于 2019-12-23 15:50:23
问题 I'm wondering if there's an easy way to get the colorspace of an image (i.e. an image loaded into a UIImage)? For example, I have a TIFF image and I'd like to be able to determine if it uses the RGB colorspace or not. Is there an easy way to do this without manipulating pixel data? I know there's some CGColorSpace functions, but none of them seem to do this, just create colorspaces and manipulate them (and much more advanced functions). Thanks in advance. 回答1: You have to get the color space

how to display MTKView with rgba16Float MTLPixelFormat

可紊 提交于 2019-12-20 04:54:25
问题 I have an MTKView set to use MTLPixelFormat.rgba16Float. I'm having display issues which can be best described with the following graphic: So the intended UIColor becomes washed out, but only while it is being displayed in MTKView. When I convert the drawable texture back to an image for display in a UIView via CIIMage, I get back the original color. Here is how I create that output: let colorSpace = CGColorSpaceCreateDeviceRGB() let kciOptions = [kCIImageColorSpace: colorSpace,

pdf images color space trouble ios

本小妞迷上赌 提交于 2019-12-12 20:42:58
问题 EDIT The pdf files I have been using apparently are on "indesign" format (whatever that means) and therefore have no colour profile, does anyone knows how can I add the profile myself if is possible at all? End of edit thanks in advance for any hand that any one can lend on this problem. First of all let me tell you that I am kind of new at developing for IOS, I am trying to make a pdf reader using quartz on xcode, everything works fine except for the rendering of the images, for some reason

How to get color components of a CGColor correctly

眉间皱痕 提交于 2019-11-29 19:30:27
问题 I have a UILabel with black color; i am writing the following code to get black color's components. UIColor *aColor = [aLabel.textColor retain]; const CGFloat* components = CGColorGetComponents(aColor.CGColor); CGColorSpaceRef colorSpace=CGColorSpaceCreateDeviceRGB(); but always this is giving Green color components instead of black color components; Is any one have idea about this? Am i passing different color space? :-( Please help me. 回答1: Most likely wrong colorspace. I guess the alpha

How to convert colors from one color space to another?

故事扮演 提交于 2019-11-29 09:13:50
Is there a Cocoa Touch way to convert colors from one color space to another? At the end of this code: UIColor *grey = [UIColor colorWithWhite: 0.5 alpha: 1.0]; CGColorRef greyRef = [grey CGColor]; int x = CGColorGetNumberOfComponents(greyRef); ... x is 2. The reason I need this is I'm trying to copy colors to a list of color components for CGGradientCreateWithColorComponents , which needs all colors in a single colorspace. The problem is that grey is in the grayscale colorspace, rather than the RGB one. (The name escapes me at the moment, but it isn't important.) CGGradientRef createGradient

How to detect the skin color of face from the source image in ios 5?

青春壹個敷衍的年華 提交于 2019-11-29 02:46:01
I need to color the skin of the face... How do i find the skin color? now i get the skin color by RGB pixel value ... Still i am facing the problem i was matching the color coordinates to match the skin by certain color range... but still some area of the face not fall in my range of colors then it is not color that area.. other than the face area may fall that region, that area also colored... Any idea about my issue... Thanks in advance.... MY code: -(void)colorImageBySliderValue:(float)value WithImage:(UIImage*)needToModified { CGContextRef ctx; CGImageRef imageRef = needToModified.CGImage;

How to match UIExtendedSRGBColorSpace to my color values

落花浮王杯 提交于 2019-11-28 08:04:17
问题 I set the color for UIButton with the XCode visual editor. I set it using RGB sliders. Then I set variable green : let green = UIColor(red: 0, green: 210/255, blue: 0, alpha: 1) When I printed out green value and UIButton.backgroundColor I got next values accordingly: UIExtendedSRGBColorSpace -0.146119 0.836984 -0.0130851 1 UIExtendedSRGBColorSpace 0 0.823529 0 1 So, as I guess, the color spaces are equal, but values are not. Why is it so? The Apple's UIButton() does some hidden conversion?

Does the result of CGImageGetColorSpace(image) have to be released?

浪尽此生 提交于 2019-11-28 03:12:05
问题 I'm scaling a CGImageRef . I found various code examples on the web that begin like so: CGColorSpaceRef colorspace = CGImageGetColorSpace(image); // "Get" color space CGContextRef context = CGBitmapContextCreate(NULL, width, height, CGImageGetBitsPerComponent(image), CGImageGetBytesPerRow(image), colorspace, CGImageGetAlphaInfo(image)); CGColorSpaceRelease(colorspace); // Really? As you can see above, the colorspace is released. However, when I do that my code works most of the time, but

How to convert colors from one color space to another?

自作多情 提交于 2019-11-28 02:36:55
问题 Is there a Cocoa Touch way to convert colors from one color space to another? At the end of this code: UIColor *grey = [UIColor colorWithWhite: 0.5 alpha: 1.0]; CGColorRef greyRef = [grey CGColor]; int x = CGColorGetNumberOfComponents(greyRef); ... x is 2. The reason I need this is I'm trying to copy colors to a list of color components for CGGradientCreateWithColorComponents , which needs all colors in a single colorspace. The problem is that grey is in the grayscale colorspace, rather than

How to detect the skin color of face from the source image in ios 5?

流过昼夜 提交于 2019-11-27 17:04:17
问题 I need to color the skin of the face... How do i find the skin color? now i get the skin color by RGB pixel value ... Still i am facing the problem i was matching the color coordinates to match the skin by certain color range... but still some area of the face not fall in my range of colors then it is not color that area.. other than the face area may fall that region, that area also colored... Any idea about my issue... Thanks in advance.... MY code: -(void)colorImageBySliderValue:(float