I am using the Hue
filter to change the hue of an image:
CIFilter* hueFilter =
[CIFilter filterWithName:@"CIHueAdjust" <blah blah>
[NSNumber numberWithFloat:hue], nil];
I have the Hue
number I wish to use from Photoshop
, but it doesn't correspond to the results I get from iOS.
Is there a rule to change the number in PhotoShop
to the number I should use in iOS
?
The Hue in HSL/HSV color mode is an angular coordinate. In Photoshop, it is given in degrees (-180 to +180).
In the CIHueAdjust filter, the angle is given in radians. From http://developer.apple.com/library/ios/#documentation/graphicsimaging/Reference/CoreImageFilterReference/Reference/reference.html#//apple_ref/doc/filter/ci/CIHueAdjust
The formula to go from Photoshop value (degrees) to CIHueAdjust value (radians) is a linear conversion: