Author |
Topic |
|
More-Majorum
France
17 Posts |
Posted - Jul 30 2022 : 06:03:17
|
Hello,
I would like to run "ImageEnView.Proc.Colorize" after picking a color from a colordialog. The problem is that I don't know how to convert the color chosen in the colordialog.
The code below obviously does not work :)
procedure TForm1.Button1Click(Sender: TObject);
Var
H, S, L : double;
begin
if colordialog1.execute then
begin
ColorToHSL(colordialog1.Color, H, S, L);
ImageEnView.Proc.Colorize(H, S, L);
end;
end;
Thank you in advance for your help. |
|
xequte
38608 Posts |
Posted - Jul 31 2022 : 00:18:41
|
Hi
In what way doesn't it work?
(ColorToHSL() is in the hyieutils unit).
Nigel Xequte Software www.imageen.com
|
|
|
More-Majorum
France
17 Posts |
Posted - Jul 31 2022 : 01:07:53
|
Hello,
An example with red from the colordialog: When converted with ColorToHSL :
procedure TForm1.Button1Click(Sender: TObject);
Var
H, S, L : double;
begin
if colordialog1.execute then
begin
ColorToHSL(colordialog1.Color, H, S, L);
ImageEnView1.Proc.Colorize(round(H), round(S), L);
Caption := 'H : ' + floattostr(H) + ' S : ' + floattostr(S) + ' L : ' + floattostr(L);
end;
end;
When converted with ColorToHSL, I get the values H=0, S=1, L=0.5. ImageEnView1.Proc.Colorize(0, 1, 0.5);
I get a gray image :) |
|
|
More-Majorum
France
17 Posts |
Posted - Jul 31 2022 : 01:37:00
|
Overall, Imageen online help is excellent (with lots of examples), which saves me from asking noob questions on the forum.
Unfortunately, regarding Proc.Colorize and ColorToHSL there is no example on how to get the values to pass in Colorize.
|
|
|
xequte
38608 Posts |
Posted - Jul 31 2022 : 02:18:08
|
Hi
What is it that you are looking for Colorize to do?
Colorize is the same as setting the HSV value for each pixel with your specified hue and saturation, and the value based on the gray-scale conversion of each pixel multiplied by your luminosity value. [code]
// Load test image ImageEnView1.IO.LoadFromFile( 'D:\TestImage.jpg' );
// Colorize the image with a sepia look ImageEnView1.Proc.Colorize( 40, 50, 1.1 );
Nigel Xequte Software www.imageen.com
|
|
|
xequte
38608 Posts |
Posted - Jul 31 2022 : 02:33:56
|
Is this what you are looking for?
// Colorize the image based on the user's selection of a color
if IEPromptForColor( cl ) then
begin
ColorToHSV( cl, h, s, v );
ImageEnView1.Proc.Colorize( h, s, 1.0 );
end;
// User selected Red...
Nigel Xequte Software www.imageen.com
|
|
|
More-Majorum
France
17 Posts |
Posted - Jul 31 2022 : 02:45:24
|
I have several frames (which I provide in white) in my application.
I would like the user to be able to change the color of these frames through a colordialog.
attach/More-Majorum/202273124515_16-9-H.png |
|
|
xequte
38608 Posts |
Posted - Jul 31 2022 : 02:49:21
|
The above method should work:
Nigel Xequte Software www.imageen.com
|
|
|
More-Majorum
France
17 Posts |
Posted - Jul 31 2022 : 02:58:34
|
Thank you very much for all these examples. I will try as soon as possible. |
|
|
More-Majorum
France
17 Posts |
Posted - Jul 31 2022 : 03:16:49
|
It works ! Thanks again for the quick help ; |
|
|
|
Topic |
|