ImageEn, unit iexBitmaps

TIEBitmap.GetHash

TIEBitmap.GetHash

Declaration

function GetHash(Algorithm: TIEHashAlgorithm = iehaMD5; SamplesCount: integer = 0; IncludeAlpha: Boolean = False): AnsiString;

Description

Calculates the hash (using the specified hash algorithm) of the bitmap and returns the string representation of the hash.
SamplesCount specifies how many samples of the image are used to compute the hash. 0 = Entire image.
If IncludeAlpha is enabled, the alpha channel is also included in the hash. Otherwise, it is ignored.

Demo

Demo  Demos\ImageEditing\EveryMethod\EveryMethod.dpr

Example

Also see: Automated Samples
// calculates MD5 hash of input.jpg raster bitmap
ImageEnView1.IO.LoadFromFile('input.jpg');
ShowMessage( ImageEnView1.IEBitmap.GetHash() );

// calculates MD5 hash of input.jpg raster bitmap, using just 256 samples
ImageEnView1.IO.LoadFromFile('input.jpg');
ShowMessage( ImageEnView1.IEBitmap.GetHash( iehaMD5, 256 ));

// calculates MD5 hash of input.jpg
with TIEHashStream.Create() do
begin
  LoadFromFile('input.jpg');
  ShowMessage( GetHash() );
end;