0
Is it possible to darken an image inside a Timage in Delphi ??? Is there a component, something like that to do it ? The Program puts the image, and I need to darken right after it is inserted...
0
Is it possible to darken an image inside a Timage in Delphi ??? Is there a component, something like that to do it ? The Program puts the image, and I need to darken right after it is inserted...
2
Guy you can convert to bitmap and scroll the pixel array pixel by pixel by changing the value of in RGB proportionally, can even exist a component but I do not know and other that the installation of many components is not cool, projects can be discontinued and some methods you can migrate from version to version.
function TForm1.GrayScale (Imagem : TBitmap) : TBitmap;
var Gray : TBitmap;
i, j : Integer;
Pixel : TColor;
GrayScale : Integer;
Red, Green, Blue : Double;
begin
Gray := TBitmap.Create;
Gray.Height := Imagem.Height;
Gray.Width := Imagem.Width;
for i := 0 to Imagem.Height do
begin
for j := 0 to Imagem.Width do
begin
Pixel := Imagem.Canvas.Pixels[j,i];
Red := GetRValue(Pixel);
Green := GetGValue(Pixel);
Blue := GetBValue(Pixel);
GrayScale := Trunc((Red * 0.3) + (Green * 0.59) + (Blue * 0.0011));
Gray.Canvas.Pixels[j,i] := RGB(Byte(GrayScale), Byte(GrayScale), Byte(GrayScale));
end;
end;
Result := Gray;
end;
This Example code switches to grayscale to get to the key you want you can change the values that multiply the RGB.
Oi Conrado. Your solution proposal sounds cool, but would you be able to provide an example (ideally in Delphi, but if not at least in pseudo-code)? So your answer becomes more complete and potentially more useful for the OP and the community.
Browser other questions tagged delphi
You are not signed in. Login or sign up in order to post.
Could add an image example before and after?
– Caputo
Do you want to do an animation? Like this one? https://stackoverflow.com/questions/21790393/how-could-i-fade-in-out-a-timage
– EMBarbosa