Nodes/import-to-hydrus/Hydrus Image Dedupe
ComfyUI Node

Hydrus Image Dedupe

Reunite your upscale with its original in Hydrus

By dsxsh·Created 2 years ago·Updated 7 months ago· 0
Hydrus Image Dedupe
      original_hash
      upscaled_hash

      If you archive every ComfyUI render into Hydrus, you've already met the problem this node exists to solve: you upscale a good generation, import the upscale, and now your library holds two copies of the same picture that Hydrus treats as total strangers. The duplicate filter starts nagging, tags drift apart, and your "archive" quietly turns into a mess. Hydrus-Image-Dedupe is the peace treaty - a tiny node that tells Hydrus the upscale and the original are the same image.

      It's part of the import-to-hydrus pack by ryphon, which is exactly what it sounds like: a set of ComfyUI nodes that talk to a Hydrus server so you can archive generations in, pull them back out, and keep the library honest. This particular node is the last step in the upscale loop, and it does one thing and nothing else.

      How it works

      You feed it two hashes - the original file's SHA-256 and the upscaled file's SHA-256. On execution it calls Hydrus's set_file_relationships endpoint with relationship: 4 and do_default_content_merge: true. The number matters: in Hydrus's own constants, 4 is DUPLICATE_BETTER, meaning "hash_a is a better duplicate of hash_b." So the node tells Hydrus the original is the better copy of the upscale, and to merge their tags and metadata. It does not delete the upscale - delete_b is never set, so it defaults to false. Both files stay; they're just now a proper duplicate pair.

      Two quirks worth knowing before they confuse you. First, there's a hardcoded time.sleep(5) at the start of the node, so every run sits still for five seconds - the author's way of letting an import settle, but you'll notice the pause. Second, it's a pure output node with no visual output: it prints the hashes and the API result to the ComfyUI console and hands you nothing. That's normal, not a bug.

      The inputs

      That's the whole list - two of them, both plain multiline strings:

      • original_hash - the SHA-256 of the pre-upscale image
      • upscaled_hash - the SHA-256 of the upscaled version

      Where do you get them? The cleanest path is the pack's Hydrus-Image-Importer: check its dedupe toggle and it returns the imported file's hash on its upscale_hash output, which you wire straight into these inputs. Or grab either hash from Hydrus itself with right-click → copy SHA256. The hashes have to exist in the Hydrus database, so pasting random hex just produces an API error.

      The intended flow (the repo's upscale_workflow.json and submit.py) is: tag files in Hydrus for upscaling, pull them out with the exporter, upscale, re-import, then run this node so original and upscale link up.

      Install and the one gotcha that bites

      Install is the same as the rest of the pack: in ComfyUI Manager, search import-to-hydrus, or

      cd ComfyUI/custom_nodes
      git clone https://github.com/ryphon/import-to-hydrus
      

      then restart ComfyUI. Dependencies are light - hydrus-api, Pillow, numpy - no models to download. Before anything works you need HYDRUS_KEY and HYDRUS_URL set (or a hydrus_api.txt inside the pack folder), and the Hydrus server running and reachable from the ComfyUI machine.

      Here's the trap: the pack's other two nodes only check for the import-files and add-tags API permissions, but this endpoint needs manage-file-relationships permission on your key. The node never verifies it, so the failure shows up as an API error mid-run. Head to Hydrus → services → manage API, and make sure the key you're using has that permission before you blame the node.

      Categoryimage

      Inputs (2)

      NameTypeDefaultDescription
      original_hashSTRING
      upscaled_hashSTRING

      Outputs (0)

      No outputs