Nodes/opencv-comfyui/OpenCV pyrUp_0
ComfyUI Node

OpenCV pyrUp_0

Double the resolution with OpenCV's pyramid upsampler

By geroldmeisinger·Created about a year ago·Updated about a year ago· 35
OpenCV pyrUp_0
  • src
  • dst
  • nparray
dstsize
borderType

pyrUp is OpenCV's image pyramid upsampler: it takes an image and doubles its width and height. Each output pixel is interpolated from a 5×5 neighborhood of the input, so the result is smooth - no blocky nearest-neighbor steps, but also none of the detail recovery you'd get from a real upscaler. This is the "deterministic and free" end of the resolution game: zero VRAM, zero model, runs in milliseconds. It won't invent texture like a Latent/ESRGAN upscale will, and it blurs a little, but when you just need a bigger canvas to work on, it's the cheap tool.

The practical use in ComfyUI is usually up-front, not as a final upscale: double a small image before sending it into a controlnet preprocessor or an img2img pass so the next stage has more pixels to chew on, or match the size of two branches you're about to combine. The sibling operation pyrDown (halves size) is the usual companion - but this pack only ships pyrUp, so for the down direction you'd grab a plain resize node instead.

Inputs that matter

  • src - your NPARRAY (BGR uint8 after Image2Nparray).
  • dstsize - a string literal, parsed with ast.literal_eval, so write it as a tuple: (0, 0) means "use the default", which is exactly 2× the input. You can instead write an explicit (w, h), but OpenCV requires both to be even and doubled-ish or it asserts; honestly just leave (0, 0).
  • borderType - an int, default 4 (BORDER_DEFAULT / REFLECT_101) is the one to use. OpenCV's docs say pyrUp only really accepts the default here; other border modes cause a runtime assertion in some builds, so don't fiddle.
  • dst - optional out-parameter, leave it unplugged.

The output is a single nparray at 2× resolution, and it comes back BGR, so it routes through Nparrays2Image on the way out.

Gotchas

pyrUp_1 next to it in the menu is a duplicate - the auto-generator made two nodes from OpenCV's two overload stubs and they turned out identical. Use either.

Also note this is a pyramid upsample, not a super-resolution. If you pipe a 512×512 latent upscaled this way into a sampler you get the classic soft, slightly smeared 1024 image - fine for compositing, wrong tool if the goal is "sharper". For that you want a real upscale pass (the KB's upscaling doc lays out the Latent → model-upscale → VAE-decode pipeline). Reach for pyrUp when you want fast and smooth, not detailed.

Install

Same story as every node in this pack: no models, just OpenCV.

cd ComfyUI/custom_nodes
git clone https://github.com/geroldmeisinger/opencv-comfyui
pip install opencv-contrib-python

Or search "OpenCV" in ComfyUI Manager, restart, and it's under image/OpenCV. If loading throws Cannot import name 'guidedFilter' from 'cv2.ximgproc', you have conflicting OpenCV packages - a known issue with a documented fix in the README. And remember: batch_size==1 only, or use ImageFromBatch at length=1 first.

Categoryimage/OpenCV

Inputs (4)

NameTypeDefaultDescription
srcNPARRAY
dstsizeSTRING
borderTypeINT
dstoptNPARRAY

Outputs (1)

NameTypeDescription
nparrayNPARRAY