Fórum brilho das imagens #147180

18/03/2003

0

alguem saberia como mecher no brilho de uma imagem via codigo no delphi?

por exemplo, um botao ´Aumenta Brilho´, q faça algo como imagem.brilho := imagem.brilho +1, um botao menos brilho q faça o contrario, alguem sabe^?

vlw, alias, estou procurando um jeito de mecher em varias propriedades de imagens atraves do delphi.. c alguem souber mecher com as mardita imagem me da um toque! vlw


Anonymous

Anonymous

Responder

Posts

19/03/2003

Anonymous

Da uma olhada nesse endereco que tem unn lances legais sobre imagem


http://www.lischke-online.de/ThemeManager.php


Responder

Gostei + 0

19/03/2003

Anonymous

Veja estas dicas retiradas da internet, vê se ajuda


1909- Como mudar o brilho de um imagem?

procedure Helligkeit(C:TCanvas; Faktor:Real);
var x, y: integer;
Color: LongInt;
R, G, B: Integer;
begin
with C do
for x:= ClipRect.Left to ClipRect.Right do
for y:= ClipRect.Top to ClipRect.bottom do
begin
Color:=ColorToRGB(Pixels[x,Y]);
R := Round(GetRValue(Color)*Faktor);
G := Round(GetGValue(Color)*Faktor);
B := Round(GetBValue(Color)*Faktor);
if R>255 then R:=255;
if G>255 then G:=255;
if B>255 then B:=255;
Pixels[x,Y]:=RGB(R,G,B);
end;
end;


1910- Como mudar o brilho de um imagem? (2)

type
TPixelBMP24 = packed record
R: byte;
G: byte;
B: byte;
end;

var
SrcBMP, DstBMP24: TBitmap;

procedure TForm1.FormCreate(sender: TObject);
begin
SrcBMP:=TBitmap.Create; {Src Bitmap erstellen}
SrcBMP.LoadFromFile(´datei´); //sollte 24Bit sein
DstBMP24:=TBitmap.Create; {24-Bit Dst Bitmap erstellen}
DstBMP24.PixelFormat:=pf24bit;
DstBMP24.Width:=SrcBmp.Width;
DstBMP24.Height:=SrcBmp.Height;
end;

function BMPRGBtoYUV(rgb: TPixelBMP24): TPixelBMP24;
var y,u,v:longint;
begin
y := rgb.G*150 + rgb.B*29 + rgb.R*77; // 0.587 x 256, 0.114 x 256, 0.299 x 256
u := (rgb.B shl 8 - y) * 144; // 0.564 x 256
v := (rgb.R shl 8 - y) * 183; // 0,713 x 256
Result.G :=y shr 8;
Result.B :=u shr 16 + $80;
Result.R :=v shr 16 + $80;
end;

function BMPYUVtoRGB(yuv: TPixelBMP24): TPixelBMP24;
var temp: integer;
begin
temp := yuv.G + (yuv.B - $80) * 256 div 144 ;
if temp > 0 then Result.B:=temp else Result.B:=0;
if temp > 255 then Result.B:=255;
temp := yuv.G + (yuv.R - $80) * 256 div 183 ;
if temp > 0 then Result.R:=temp else Result.R:=0;
if temp > 255 then Result.R:=255;
temp := (yuv.G shl 8 - Result.B*29 - Result.R*77) div 150;
if temp > 0 then Result.G:=temp else Result.G:=0;
if temp > 255 then Result.G:=255;
end;

procedure TForm1.Button4Click(Sender: TObject);
var x, y: integer;
SrcPixel: ^TPixelBMP24;
DstPixel: ^TPixelBMP24;
yuv: TPixelBMP24;
begin
for y:=0 to SrcBMP.Height-1 do // SrcBMP und DstBMP24 sind gleich groß !!!
begin
SrcPixel:=SrcBMP.ScanLine[y];
DstPixel:=DstBMP24.ScanLine[y];
for x:=0 to SrcBMP.Width-1 do
begin
yuv:=BMPRGBtoYUV(SrcPixel^);
yuv.R:=$80;
yuv.B:=$80;
DstPixel^ := BMPYUVtoRGB(yuv);
inc(SrcPixel);
inc(DstPixel);
end;
end;
Image1.Picture.Graphic:=DstBMP24;
end;


1911- Como tingir uma imagem?

procedure Faerben(C:TCanvas);
var x, y: integer;
Color: LongInt;
R, G, B, Gr: Byte;
begin
with C do
for x:= ClipRect.Left to ClipRect.Right do
for y:= ClipRect.Top to ClipRect.bottom do
begin
Color:=ColorToRGB(Pixels[x,Y]);
R := GetRValue(Color);
G := GetGValue(Color);
B := GetBValue(Color);
Gr := Trunc(B*0.11+G*0.59+R*0.3);
//*************************
Pixels[x,Y]:=RGB(Gr,0,0);
// Pixels[x,Y]:=RGB(0,0,Gr); -> Blau
//*************************
end;
end;


1912- Como converter uma imagem em tons cinzentos?

procedure GrauStufen(C:TCanvas);
var x, y: integer;
Color: LongInt;
R, G, B, Gr: Byte;
begin
with C do begin
for x:= ClipRect.Left to ClipRect.Right do
for y:= ClipRect.Top to ClipRect.bottom do
begin
Color:=ColorToRGB(Pixels[x,Y]);
R := GetRValue(Color);
G := GetGValue(Color);
B := GetBValue(Color);
Gr:= Trunc(B*0.11+G*0.59+R*0.3);
Pixels[x,Y] := RGB(Gr, Gr, Gr);
end;
end;
end;


Responder

Gostei + 0

15/02/2004

Luciano2080

Estou desenvolvendo um sistema de manipulação de imagens com Delphi. Este sistema consiste em modificar uma imagem JPG ou BMP com a utilização de cores em RGB, mas estou com dificuldades em encontrar uma solução para isto, encontrei alguns componentes, mas nenhum coube ao projeto. Então venho solicitar se há possibilidades de efetuar-mos uma parceria no desenvolvimento deste software. Aguardo posição

Luciano Lourenco
luciano@branco-produtos.com.br


Responder

Gostei + 0

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar