TImageEnMView.RemoveDuplicates
Declaration
function RemoveDuplicates(): Integer; overload;
function RemoveDuplicates(Threshold: Double; Algorithm: TIEVisionImageHashAlgorithm = ievHashPHash): Integer; overload;
Description
Locate images with duplicate content in the TImageEnMView and remove other instances. The first image of each group of duplicates is kept.
Returns the number of removed pages.
The first overload only finds images with exactly the same pixels (using an
MD5 Hash).
The second overload (requires
IEVision) uses a
perceptual hash, so it also removes near-duplicates, such as resized, recompressed or slightly edited copies. An image is a duplicate if its similarity to an earlier image is
Threshold or higher (0 to 1, where 0.75 is a good value. See
similarity). It works with any
StoreType (images loaded on demand are loaded to be hashed, and thumbnails are hashed as they are).
Note:
◼The first overload does not call
OnDestroyImage
◼Cannot be used if a
TIEDBMultiBitmap is
attached to the control
Examples
// Ensure there are no duplicate images in our TImageEnMView after filling it from a folder
ImageEnMView1.Clear();
ImageEnMView1.StoreType := ietNormal;
ImageEnMView1.FillFromDirectory('C:\Images');
ImageEnMView1.RemoveDuplicates();
// Also remove resized and recompressed copies
ImageEnMView1.RemoveDuplicates( 0.75 );
See Also
◼FindSimilar