I want to change the "brightness" of an NSImage
.
I've searched a bit around but I found nothing really helpful...
So, what is the easiest, Cocoa-friendly way to do that?
You can do it with Core Image Filters. But You need to use CIImage
not NSImage
so You will need to convert it. Here is CIFilter Reference with all filters. Take a look at "CIColorControls" it will let You achieve what You want.
CIColorControls
Adjusts saturation, brightness, and contrast values.
Parameters
inputImage (A CIImage class whose display name is Image).
inputSaturation (An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Saturation. Default value: 1.00 Minimum: 0.00 Maximum: 2.00 Slider minimum: 0.00 Slider maximum: 2.00 Identity: 1.00)
inputBrightness (An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Brightness. Default value: 0.00 Minimum: -1.00 Maximum: 1.00 Slider minimum: -1.00 Slider maximum: 1.00 Identity: 0.00)
inputContrast (An NSNumber class whose attribute type is CIAttributeTypeScalar and whose display name is Contrast. Default value: 1.00 Minimum: 0.00 Maximum: 4.00 Slider minimum: 0.00 Slider maximum: 4.00 Identity: 1.00)