Compare Image Similarity π
Find the look-alike in your image folder
- input_image
- image
- mask
- FILE_PATH
- FILE_NAME
- SIMILARITY_SCORE
Compare Image Similarity answers a surprisingly common question: "I have this image, and I have a folder of a thousand others - which ones look the most like it?" You feed it one image and a folder path, and it returns the closest matches as actual IMAGE outputs, plus the file paths and similarity scores so you know exactly what you got and why.
What it actually does
The inputs are mercifully few: input_image, folder_path, and the settings that matter:
similarity_method-cosine(angle between feature vectors, the default) oreuclidean(distance-based). Cosine is the usual pick; it's more forgiving of brightness/scale differences.return_best_n- how many top matches to return (1β100).resize_images- defaultFalse, meaning matches come back at original resolution. That's the author's recommendation, and it's right: the search can run on tiny thumbnails while you still get full-quality output.use_cache/force_refresh_cache- embeddings are cached to ComfyUI's temp directory (keyed by a hash of the folder path) so re-running the same search on the same folder is instant.force_refresh_cachenukes the cache if files changed but the cache didn't notice.
Outputs: image, mask (an empty mask in the shape of the image, ready for compositing), FILE_PATH, FILE_NAME, and SIMILARITY_SCORE.
The honest caveat
Here's the part the README doesn't shout: this isn't a learned semantic embedding. The source resizes every image to 224Γ224 and flattens the pixels into a raw feature vector - no CLIP, no ViT, no neural network. That means it's good at finding visually similar images: near-duplicates, same composition, same color grading, crops of the same shot. It will not understand that a beach photo and a "sunset, sand, ocean" painting are conceptually related - for that you'd need a CLIP-based matcher. If your use case is "dedupe my output folder" or "find the original this was edited from," it's great. If you expected semantic similarity, set expectations accordingly. The caching is real though: use_cache bakes a pickle of all the folder features, so subsequent runs on the same folder skip the re-encode entirely.
Installing and using
It ships in the drmbt/comfyui-dreambait-nodes grab-bag. ComfyUI Manager: search "comfyui-dreambait-nodes". Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/drmbt/comfyui-dreambait-nodes
then restart ComfyUI. Note the pack bundles heavy deps (transformers, bitsandbytes, librosa) that this node never touches - that's the cost of the bundle. If you hit a wall, the debug_mode toggle exists for exactly this: it dumps detailed logging so you can see which folder files failed to load (corrupt images get skipped with a warning, not a crash).
Worth it if you keep a big reference folder. Just remember it's pixel-similarity, not a semantic search.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| input_image | IMAGE | β | |
| folder_path | STRING | Path to folder containing images to search through. | |
| similarity_method | COMBO | cosine | Method to calculate similarity: cosine for angle-based similarity, euclidean for distance-based. |
| resize_images | BOOLEAN | false | If True, resize output images to match input image dimensions. If False, keep original dimensions (recommended). |
| return_best_n | INT | 11β100 | Return the N most similar images. |
| use_cache | BOOLEAN | true | Use cached embeddings for faster processing. Cache is only recalculated if folder contents change. |
| force_refresh_cache | BOOLEAN | false | Force recalculation of embeddings regardless of cache. |
| debug_mode | BOOLEAN | false | Enable detailed debug logging for troubleshooting. |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | β |
| mask | MASK | β |
| FILE_PATH | STRING | β |
| FILE_NAME | STRING | β |
| SIMILARITY_SCORE | FLOAT | β |