0

I have a UIImage that is jpeg with a background color that is one of six RGB color combinations. The JPeg could, however, be compressed.

I need to determine which of the six RGB color combinations most closely matches the background color. I know that the lower right corner of the image will always be the background color, so there no concern about knowing where to sample the image.

My question is, "Is there a fairly simple way of doing this without writing a ton of code?"

Thanks, in advance, for any suggestions.

RegularExpression
  • 3,531
  • 2
  • 25
  • 36

1 Answers1

1

There's another post on SO telling you how to sample an image to get the background colour: How to get the RGB values for a pixel on an image on the iphone

Then you'll want to find the closest matching color, which depends on the colour space you're using: Objective C Find closest color (rgb) match

I don't know of a really simple way, this is a bit more complex than you'd expect at first thought :)

Community
  • 1
  • 1
dirkgroten
  • 20,112
  • 2
  • 29
  • 42