I want to apply saturation to photo using php gd but I only know that to do image editing. I need to:
- Change BGR to HSL
- do something which I don't know.
- Change the result back from HSL to BGR.
Anyone know what is the logic/algorithm for step 2? And is there any other better way to apply saturation to photo in php?
Edit: What I mean by "apply saturation" is manipulating/changing saturation of photo like how you can do in most of the image editing tool like ipiccy.com and edit photo function in Microsoft office 2010 where you can change value of slider and then saturation of photo will change. I want to write code in php to change saturation of photo but I have no clue how to start. Anyone can advise? Thank you.
If you are looking for any transformation, you can simply apply one simple curve to your saturation channel. And since it's not important what transformation you are applying, you can use a simple x^0.5 curve.
Take a look at this wikipedia entry for more information on curves.
And if you wonder how to implement a x^0.5 curve, here it is. Considering saturation as a byte ranging from 0 to 255: