[Gambas-user] Color Range

Benoit Minisini benoit.minisini at gambas-basic.org
Tue Jul 25 21:33:04 CEST 2023

Le 25/07/2023 à 20:22, Claus Dietrich a écrit :
> Am 25.07.23 um 14:28 schrieb Gianluigi:
>>> Hi Gianluigi
>>> Thanks, I am aware of it and use it a lot.
>>> I had a closer look to gb.image.effect, which offers the methods 
>>> "Normalize" and "Equalize". The spectrogramm showed me, that 
>>> "Equalize" is getting close to what I am looking for, but it does it 
>>> automatically and for all colors. The context-description of the 
>>> method "Normalize" also fits to my requirements, but its visual 
>>> effect is very small and it also works fully automatic and for all 
>>> colors.
>>> Is there any known documentation about gb.image.imlib?
>>> Best regards
>>> Claus
>> It's not clear to me if you want to do something like this (*)? Maybe 
>> you should explain the problem better.
>> Best regards
>> Gianluigi
>> (*) see link : https://paste.c-net.org/GymnastCylinder
> Hi Gianluigi
> Its all about my Gambas scanner program, which after years became pretty 
> mature and it's doing a fantastic job for documents and photographs. But 
> now I am planning to digitize tons of aged paper photographs (I guess 
> more than thousand). Normally I use two dialogues within Gimp (see 
> attached screenshots) to correct the ageing effects. The one shows the 
> spreading of the color range (showing a typical spectrogram for red of 
> an old photograph as reference) while the other provides an adjustment 
> of the color curve, with a spectrogram in the background for 
> orientation. Normally I do adjustments for red, green and blue 
> separately. To do this for more than thousand photos in a separate 
> application would be crazy. Like in good scanner apps I like to be able 
> to do exactly this within my app. Post corrections for Lightness, 
> Contrast and Gamma are already implemented but they cannot compensate 
> ageing effects.
> I already tested a post correction for aged photographs with the fully 
> automatic "Equalize" method, but the results are unpredictable and are 
> ranging from good to very poor. I compared this method with Gimp and 
> found, that the results are identical to those of the Gimp's 
> Auto-Contrast feature, which is not what I need.
> Hope that someone has an idea, how this can be done within Gambas.
> Best regards
> Claus

If you know the algorithm associated with the the image filter you need, 
you can try to implement it by accessing the image RGBA data directly, 
and use the FAST keyword to let the gcc compiler transform your Gambas 
code into a faster version.

As I understand the dialog box, you need to be able to define a function 
that takes a color intensity between 0 and 255 and that returns the new 
value, and apply that functino to a color channel.

Please confirm my interpretation!


Benoît Minisini.

More information about the User mailing list