TIEMultiBitmap.RemoveDuplicates
Declaration
function RemoveDuplicates(): Integer; overload;
function RemoveDuplicates(Threshold: Double; Algorithm: TIEVisionImageHashAlgorithm = ievHashPHash): Integer; overload;
Description
Locate images with duplicate content in the TIEMultiBitmap 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).
Examples
// Ensure there are no duplicate images in our TIEMultiBitmap after filling it from a folder
MBitmap.Clear();
MBitmap.FillFromDirectory('C:\Images');
MBitmap.RemoveDuplicates();
// Also remove resized and recompressed copies
MBitmap.RemoveDuplicates( 0.75 );
See Also
◼FindSimilar
◼IndexOf
◼ImageHash