Nodes/ComfyUI-FBCNN/JPEG Compression Removal - FBCNN
ComfyUI Node

JPEG Compression Removal - FBCNN

Cleaning up a re-compressed image before you do anything else with it

By Miosp·Created 3 years ago·Updated about a year ago· 41
JPEG Compression Removal - FBCNN
  • image
  • IMAGE
auto_detect
compression_level0

If you've ever pulled an image off some random mirror, a Discord attachment, or a screenshot of a screenshot, you know the look: blocky squares around edges, ringing halos near high-contrast lines, that slightly smeared quality where fine detail used to be. That's JPEG compression damage, and it's a specific, well-understood kind of ugly - not noise, not blur, not a bad scan. This node exists to undo exactly that one thing.

It's built on FBCNN ("Flexible Blind CNN"), a real academic model from the paper Towards Flexible Blind JPEG Artifacts Removal - a CNN trained specifically to reverse lossy JPEG encoding. Worth being clear about what it isn't: it doesn't add pixels, doesn't invent detail, and isn't a generative restorer like SUPIR or SeedVR2. Same resolution in as out. It's a cleanup pass, not an upscale, even though ComfyUI files it under image/upscaling because there's nowhere better to put a single-purpose restoration node. Run it before your real upscaler on a source that's been through the JPEG wringer, so the upscaler isn't amplifying compression blocks along with everything else.

JPEG damage scales with how aggressively a file was compressed - a "quality factor" from 0 (garbage) to 100 (near-lossless), the same number you'd pick when you hit "save as JPEG." FBCNN was trained to either guess that number itself or take your word for it, and that split is the whole interface.

The inputs and output

Three fields, and the two that matter fight for control of the same decision:

  • image - whatever you're cleaning up.
  • auto_detect (enable / disable) - when enabled, the model estimates the compression level on its own using its built-in quality estimator. This is the important gotcha: with auto_detect on, compression_level is completely ignored, even if you've set it to something. That's not a bug, it's the author's own documented behavior - if you're fiddling with the slider and seeing no change, that's why.
  • compression_level (0–100, default 0) - only read when auto_detect is disable. Set this to your best guess of how compressed the source actually was: lower numbers tell the model "this was hammered, restore aggressively," higher numbers tell it "this is mostly fine, go easy." Guess too low relative to the real damage and you're inviting over-smoothing on an image that didn't need much help - same overcorrection risk as any restoration model fed a worse-than-real damage estimate.

Output is a single IMAGE - same dimensions, compression artifacts scrubbed. Wire it straight into a Save Image node, or hand it to a proper upscaler (ESRGAN, SeedVR2, whatever you'd normally reach for) now that it isn't dragging JPEG blocks along for the ride.

For most people, leaving auto_detect on enable and ignoring compression_level entirely is the right call - the built-in estimator is the whole point of "flexible blind" in the name. Only flip to manual if the auto result looks under- or over-corrected and you want to steer it yourself.

Installing it

Either ComfyUI Manager - search ComfyUI-FBCNN, install, restart - or by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/Miosp/ComfyUI-FBCNN

Restart ComfyUI and it shows up under image/upscaling. Dependencies are just PyTorch, numpy, and requests - all things you already have if ComfyUI runs at all, so there's no extra pip install dance for the common case. The requests dependency is there for a reason: it's what pulls the FBCNN model weights the first time you actually run the node, so expect a short one-time download and a moment of network access on first use, after which it's cached and runs offline.

Where this node is and isn't the right tool

The one real trap: this node fixes JPEG re-compression, specifically, and nothing else. If your source problem is dust, scratches, film grain, or general scan degradation rather than blocky compression artifacts, don't expect much - someone on r/comfyui tried exactly this on an old black-and-white scan ("Trying to clean up B&W scans") and reported that FBCNN "did nothing," which tracks: that's not the damage this model was trained to reverse. For genuine physical-damage restoration, you want the generative restoration stack instead (Qwen-Edit paired with SeedVR2 is the current standing recipe for that job).

Beyond that, the two practical snags are both covered above: forgetting that auto_detect: enable silently overrides whatever you typed into compression_level, and manually guessing a compression level that's more aggressive than the real damage, which invites the model to over-smooth an image that was mostly fine. Since it's a single small node with no heavy custom dependencies, that's really the extent of what goes wrong with it - this isn't a pack with a long list of install landmines.

Categoryimage/upscaling

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
auto_detectCOMBO2 options: enable, disable
compression_levelINT00–100

Outputs (1)

NameTypeDescription
IMAGEIMAGE