ImageEn, unit imageenproc

TImageEnProc.WriteHiddenData

TImageEnProc.WriteHiddenData


Declaration

function WriteHiddenData(data: PAnsiChar; count: Integer): Integer;


Description

WriteHiddenText and WriteHiddenData write hidden text or raw data within a true color image. Hidden information is stored inside the image (uses a pixel color modulation) and is independent of the image file format.
Use WriteHiddenText to write a simple string or WriteHiddenData to write a block of bytes (e.g. to embed a hidden image or sound).

Note:
The hidden text will be lost if you save the image as Jpeg or if you subsample the colors.
If the image PixelFormat is not ie24RGB, it will be converted


Example

// Hide image "alfa.jpg" within "beta.jpg", then save as "gamma.png"
procedure TForm1.Button2(Sender: TObject);
var
  ms: TMemoryStream;
begin
  ImageEnView1.IO.LoadFromFile('C:\beta.jpg');
  ms := TMemoryStream.Create;
  ms.LoadFromFile('C:\alfa.jpg');
  ImageEnView1.Proc.WriteHiddenData(ms.Memory, ms.Size);
  ms.Free();
  ImageEnView1.IO.SaveToFile('D:\gamma.png');
end;

// Read a hidden Jpeg image
procedure TForm1.Button1Click(Sender: TObject);
var
  ms: TMemoryStream;
Begin
  ImageEnView1.IO.LoadFromFile('D:\gamma.png');
  ms := TMemoryStream.Create;
  ms.Size := ImageEnView1.Proc.ReadHiddenData(nil, 0) );
  ImageEnView1.Proc.ReadHiddenData(ms.Memory, ms.Size);
  ImageEnView2.IO.LoadFromStreamJpeg(ms);
  ms.Free;
End;


See Also

ClearHiddenText
GetHiddenDataSpace
ReadHiddenData
ReadHiddenText
WriteHiddenText