ImageEn, unit hyieutils

TIEHashStream.SaveToFile

TIEHashStream.SaveToFile


Declaration

procedure TIEHashStream.SaveToFile(const filename: WideString);


Description

Saves the stream to file (this is the actual data written, not the hash). This is useful to save the hashed data once.
It is necessary to create the stream as "buffered" to use this method.

See also: SaveToStream


Example

// Save image with a unique name (by creating a hash from the jpeg content and using it as the filename)
var
  hashStream: TIEHashStream;
begin
  ImageEnView1.IO.LoadFromFile('input.jpg');
  hashStream := TIEHashStream.Create(iehaMD5);
  try
    ImageEnView1.IO.SaveToStreamJpeg(hashStream);
    hashStream.SaveToFile(hashStream.GetHash()+'.jpg');
  finally
    hashStream.Free;
  end;
end;