procedure TForm1.EncryptBMP(const BMP: TBitmap; Key: Integer);
var
BytesPorScan: Integer;
w, h: integer;
p: pByteArray;
begin
try
BytesPorScan := Abs(Integer(BMP.ScanLine[1]) -
Integer(BMP.ScanLine[0]));
except
raise Exception.Create('Error');
end;
RandSeed := Key;
for h := 0 to BMP.Height - 1 do
begin
P := BMP.ScanLine[h];
for w := 0 to BytesPorScan - 1 do
P^[w] := P^[w] xor Random(256);
end;
end;
------------------
procedure TForm1.btn_encrypt_1Click(Sender: TObject);
begin
EncryptBMP(ImageEnView1.Bitmap, 623);
ImageEnView1.Refresh;
ImageEnView1.IO.SaveToFile('C:\jpg_test\crypted_623.JPG');
end;