I'm writing a chrome extension that saves images from websites. In addition to saving the files themselves, I'd like to turn the images into some type of hash.
The objective is to index the images in a database so that I can easily determine if an image is a duplicate (independent of size, i.e., a thumbnail and a full-size image would be considered duplicates). I'm not really worried about images with slight differences (besides size).
I've tried to work with this library, but it's large, a bit slower than I'd like, and (ostensibly) not supported anymore.
I've also tried a number of phash
algorithm implementations, but as near as I can tell, they're all intended for server-side use. I'm using webpack
, which was unable to bundle any of the libs I tried (very possible this is user-error, i'm no webpack-pro).
Lastly, I tried converting the image to base64, but the results are 10k+ characters, and it's not clear to me this would work for images of different sizes.