I need a code for replacing colors in bitmap based on functionality of Corel PhotoPaint, where each pixel is recalculated based on HSL (HSI) difference between source and target color.
You better check the functionality with Corel PhotoPaint if you are not 100% sure of specification.
Code should not create any temporary files during image processing.
* * *
**Conversion from RGB to HSL**
Let *r*, *g*, *b*? = [0,1] (*full range*) be the red, green, and blue coordinates, respectively, of a color in RGB space.
Let max be the greatest of *r*, *g*, and *b*, and min the least.
To find the hue angle *h*? = [0, 360] (*full range*) for HSL space, compute:
![][1]
To find saturation and lightness *s*, *l*? = [0,1] (*full range*) for HSL space, compute:
![][2]
![][3]
The value of *h* is generally normalized to lie between 0 and 360°, and *h* = 0 is used when *max* = *min* (that is, for grays) though the hue has no geometric meaning there, where the saturation *s* is zero. Similarly, the choice of 0 as the value for *s* when *l* is equal to 0 or 1 is arbitrary.
The range of HSL vector is a cube in the cartesian coordinate system; but since hue is really a cyclic property, it is not so necessary or appropriate to unwrap it, with a cut at 0 (red), into a linear coordinate. Therefore, visualizations of these spaces invariably involve hue circles; cylindrical and conical (bi-conical for HSL) depictions are most popular; spherical depictions and other color solids are also possible.
?
* * *?
*
For? **Conversion from HSL to RGB** see? **Other Requirements** section below...*
## Deliverables
?
**Conversion from HSL to RGB**
Given a color defined by (*h*, *s*, *l*) values in HSL space, with *h* in the range [0, 360), indicating the angle, in degrees of the hue, and with *s* and *l* in the range [0, 1], representing the saturation and lightness, respectively, a corresponding (*r*, *g*, *b*) triplet in RGB space, with *r*, *g*, and *b* also in range [0, 1], and corresponding to red, green, and blue, respectively, can be computed as follows:
First, if *s* = 0, then the resulting color is achromatic, or gray. In this special case, *r*, *g*, and *b* all equal *l*. Note that the value of *h* is ignored, and may be undefined in this situation.
The following procedure can be used, even when *s* is zero:
![][4]
![][5]
![][6]? ? ? ? ? ? ? ? ? ? ? ? (*h* normalized to be in the range [0,1))
![][7]
![][8]
![][9]
![][10]
![][11]
Compute each color component *ColorC* of the vector (*ColorR*, *ColorG*, *ColorB*) = (*r*, *g*, *b*),
![][12]
![][13]
* * *This broadcast message was sent to all bidders on Monday Jan 19, 2009 8:30:01 AM:
Description for this project has been modified to give you more information, as many bidders didn't understand the specification properly. Additionally, based on bids I have received, the maximum acceptanced bid has been decreased to $49.00
* * *This broadcast message was sent to all bidders on Monday Jan 19, 2009 10:26:25 AM:
I uploaded a sample to the project specification (there is also a zip file and image files uploaded), so now you can see the real sample...
* * *This broadcast message was sent to all bidders on Tuesday Jan 20, 2009 2:34:14 PM:
see C/C++ source code at [login to view URL]