Witam, oto problem:
Wczytuję obrazek w formaci jpg i przepisuje do TBitmap:
var
rozszez : string;
b : TBitmap;
j : TJpegImage;
begin //
odImg.Execute; //
if odImg.FileName <> '' then
begin
b :=Tbitmap.Create;
j := Tjpegimage.Create;
b.Height := image.Height;
b.width := image.Width;
b.PixelFormat := pf24bit;
j.LoadFromFile(odImg.FileName);
b.assign(j);
image.Picture.Bitmap :=b;
b.Free;
j.Free;
end;
end;
Następnie bawię się kolorami:
var
r,g,b : byte;
i,j: integer;
begin
for i := 0 to Image.height-1 do
begin
for j:= 0 to Image.width-1 do
begin
r := GetRValue(image.Picture.Bitmap.canvas.Pixels[i,j]);
g := GetGValue(image.Picture.Bitmap.canvas.Pixels[i,j]);
b := GetBValue(image.Picture.Bitmap.canvas.Pixels[i,j]);
image.Picture.Bitmap.Canvas.Pixels[i,j] := RGB(b,r,g) ;
end;
end;
end;
Efekt:
[IMG]http://www.img-share.net/uploads/187przyklad.jpg[/IMG]
[IMG]http://www.img-share.net/uploads/164przyklad2.jpg[/IMG]
Inaczej się dzieje w przypadku gdy H > V i na odwrót.
Dlaczego przetwarza tylko część obrazka???