2

What would be the most efficient way to remap the colors of an image to a gradient for iOS? This is defined as "apply a color lookup table to the image" in the Image Magic docs, and generally I think. Is there something built in core image for instance to do this? I know it can be done with ImageMagick code using convert -clut, but not certain that is the most efficient way to do it.

the result of remapping the image to a gradient is as pictured here: http://owolf.net/uploads/ny.jpg

The basic formula, copied from fraxel's comment is:

1.Open your image as grayscale, and RGB

2.Convert the RGB image to HSV (Hue, Saturation, Value/Brightness) color space. This is a cylindrical space, with hue represented by a single value on the polar axis.

3.Set the hue channel to the grayscale image we already opened, this is the crucial step.

4.Set value, and saturation channels both to maximal values.

5.Convert back to RGB space (otherwise display will be incorrect).

Community
  • 1
  • 1
OWolf
  • 5,012
  • 15
  • 58
  • 93
  • 1
    certainly the most efficient way is using opengl es 2 to perform this using a shader. But it might be an overkill for what you want to do. – Pochi Jun 06 '12 at 04:39

0 Answers0