Real-time Image Curves (using cubic splines)
Adjusting an image’s colors using a “curves” dialog should be familiar to any PhotoShop users out there. Curves is similar in theory to both “level adjustments” and standard gamma correction, but it provides a much more powerful interface for adjusting luminance and color balance.
This project provides results very similar to Photoshop’s, and it allows the creation of more spline knots (32 instead of 16). The cubic spline code on which I based my code was taken from Jason Bullen’s excellent “Simple Cubic Spline Curve Plot” (available at Planet Source Code).
The code is well-commented and very fast.
Download the sample app and source code from GitHub
For a more advanced version of this tool, check out the source code for the Adjustments > Curves tool in PhotoDemon, my open-source photo editor. PhotoDemon’s version of the tool allows you to adjust each channel individually (red, green, blue) with an improved UI and faster underlying algorithm, as shown in the screenshot below.