hi everybody,
i want to develop a application, that opens an image (JPG or whatever)
and applies an sepia-photo-filter on it, befor it saves the changed
image into a file with another name.
i have no problem in opening the image, gaining the RGB-values of any
pixel and save the image afterwards. my problem is just, that i don't
know, how to program such a filter.
it should look like the effect, i have in my Photoshop CS 2, under
Image/Adjustments/Photo Filter (for german users: Bild/Anpassen/
Fotofilter). of course i can draw an transparent brown rectangle on my
image, but this doesn't look like the filter of photoshop and above
all it doesn't look that good.
i tried to read the RGB-value of a pixel, transform it into HSB-color
model and change the pixel-data. first by setting the hue to the value
of the brown-tone, but brown is just an orange-hue with something like
50% saturation and 50% brightness. after recognizing this, i tried to
set the hue to the the hue of the brown, that i want, and multiplied
the saturation and the brightness of my brown with the values of the
pixel. this ends in a very dark version of my image, when i just
multiply the saturation-values its brighter, but also not the effect i
seek. by the way, multiplying the values worked because my HSB-values
are all between 0.0 and 1.0. my second attempt was to transform the
RGB-values of the pixel into Lab, because i've read that photoshop
takes this as base of all transformations. then i tried to set the a-
and the b-value to the one of my brown-tone. ... ... ... well ... this
doesn't end well. :-(
has somebody an idea how this can be done? i would appreciate any help
here.
you don't have to write much. i just need the mathematic operations,
that i have to perform on my image (maybe with a hint in which color-
model i have to work on this) or just a link to a proper solution.
many thanks :-)
wayne


|