Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Color values from a CGImage



Thanks for the response, I'll elaborate a bit on what I'm trying to do:

I have to images that I run through a CIFilter (CIDifferenceBlendMode), the result of this filter goes through another filter (CIAreaAverage), which returns a single pixel image that represents the average color value of the difference blend. If the result is a black pixel, the images were the same. Anything other then black means there was a difference. I want to measure the RGB values of the result of th average filter so I can assess how much difference there was, so I'm looking for a way to represent the RGB values in numbers.

MB

On 1 mrt 2008, at 00:45, Scott Thompson wrote:


On Feb 29, 2008, at 4:30 PM, Marcel Borsten wrote:

Hi all,

Is there an easy way to get the color values (RGB or RGBA) out of a pixel from a CGImage?

In general, no, because a CGImage doesn't contain pixels. :-)

To do what you are trying to do, however, you need to create a CGBItmapContext in the color space of your choice and draw the image into that context.  You can then read the value of the bitmap context's pixels from the memory that you supply when you create it.

Scott



Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartz-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartz-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.