Click here to Skip to main content
15,888,527 members
Articles / Programming Languages / C#

Image class which contains an array of unique colors with counts used to sort by color and find duplicates.

Rate me:
Please Sign up or sign in to vote.
5.00/5 (2 votes)
19 Nov 2021CPOL4 min read 7.2K   4  
Image class which contains an array of unique colors with counts used to sort by color and find duplicates.
We can use hashes to find exact duplicates of images but that's where it ends. I've written a class that uses a reduced image of a smaller size keeping the original width height ratio down to maximum of 128 pixels. The next step makes a dictionary of unique colors in the thumbnail and tallies the count of each color. A flat array of color information is extracted for speed. The array is used to in sort and equality routines. Exact duplicate checking is quite fast, if the original width, height, or the count of unique colors is different the extra step of comparing colors can be skipped. If an image is flipped left to right or top to bottom the color information is still the same. I did not discover a way to determine if two images were similar but not identical. I tried to compare color usage percentages to some degree but my results were sporadic. Sorting does work to a degree in the current build. Images are generally sorted dark to light and some are grouped by subject.

Views

Daily Counts

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Comments and Discussions