changing brightness and contrast in an nsimage
changing brightness and contrast in an nsimage
- Subject: changing brightness and contrast in an nsimage
- From: Eric Smith <email@hidden>
- Date: Fri, 2 Dec 2005 21:29:48 -0800
I've been going around in circles with this one...
What is a good way to change the brightness and contrast in an NSImage?
I've been playing with the vImage library for changing contrast,
using the vImageEndsInContrastStretch. This works, but how does one
return the contrast to it's original value? Once you specify that >
0% of the pixels lie at the histogram extreme, you can't get the
original values back. I know of the ImagApp example showing how to
use CIImage, but using that would require a re-write of quite a bit
of code... I'd rather not go there.
I start with images that have maximum contrast to begin with (I get
digital data from a sensor, then create an NSImage by scaling the
pixel values from 0 -255). So when I stretch the contrast, a bunch
of pixels hit the rails... those values are gone forever. Same thing
if I compress the contrast... quantization destroys the original
information. How do people typically deal with this? Take iPhoto.
If I change the contrast, I can move the slider back to low contrast,
and all the data seems to be there... do they just not allow any data
to hit the 0-255 rail, or is a temporary copy being stored? If I
keep increasing contrast, quitting, increasing contrast, quitting,
etc, I CAN destroy the information, and have to revert to original...
therefore, I'd say that not allowing data to hit the rail is not the
answer.
Any discussion, up to and including sample code, would be greatly
appreciated.
Thanks,
Eric
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden