3

I have searched the web high and low and found some examples which lets you extract out one color and make it transparent for an image i.e. background color. This was done with methods like CGImageCreateWithMaskingColors. What I'm trying to do is the opposite though. I want to extract out all colors from an image except for one color. Is that possible, and how?

Cyrille
  • 25,014
  • 12
  • 67
  • 90
ken
  • 87
  • 1
  • 6
  • 2
    You may find this answers helpful: http://stackoverflow.com/questions/448125/how-to-get-pixel-data-from-a-uiimage-cocoa-touch-or-cgimage-core-graphics – Jakub Nov 15 '13 at 12:36
  • Where are you stuck? What does your code look like at this point? – user1118321 Nov 16 '13 at 06:25
  • Thanks Kuba, I'm looking at the link and will be trying that option out. I'm actually stuck where I have no idea what api to use to make all colors in the pixel transparent except for 1 color only. – ken Nov 17 '13 at 02:40
  • I could tell you how to do it in OpenGL. – badweasel Nov 17 '13 at 05:55
  • Do you mean one exact color.. like (.3,.4,.2) or do you mean color as in HUE? Normally for something like that you would have a threshold too. So anything within a certain range, with softening of the alpha channel on the edges of that range. You're talking about like a chroma key.. but the reverse of it.. you could do the key. .and then alpha = 1.0 - alpha – badweasel Nov 17 '13 at 05:57
  • Yes I actually mean one color. It will be a flat color with some RGB value and it could be spread across pixels in an image. I'm still stucked at this point though. – ken Nov 18 '13 at 07:27

0 Answers0