gitmyhub

ComfyUI_KleinTiledUpscaler

Python ★ 31 updated 5d ago

A ComfyUI plugin that upscales images by processing them tile by tile so they fit on GPUs with limited memory, with automatic seam prevention, color matching, and detail-aware quality settings designed for the Flux2.Klein model.

PythonComfyUIsetup: easycomplexity 2/5

Klein Tiled Upscaler is a custom plugin for ComfyUI, a popular visual interface for running AI image generation workflows. Its purpose is to take a lower-resolution image and enlarge it to a higher resolution while having the AI fill in realistic new detail rather than simply stretching pixels. It is designed specifically for use with a model called Flux2.Klein.

The approach it uses is called inpainting-based tiling. Rather than upscaling the entire image at once, which can crash on GPUs with limited memory, the tool divides the image into a grid of smaller sections called tiles and processes each tile individually in sequence. This keeps memory usage low. The challenge with tiling is that the boundaries between tiles can look like visible grid lines or color shifts in the final image. The plugin includes several features aimed at preventing those seams, including automatically calculating tile sizes so every tile is the same dimensions, matching the color and contrast of each tile to the original image, and softening the edges where tiles meet.

The plugin also analyzes the image before processing to identify which areas contain fine texture or edge detail, such as fabric or foliage, and which are flat and uniform, such as sky or plain walls. Tiles with rich detail are processed at higher quality settings while flat areas use fewer steps, which saves render time without sacrificing output quality in the areas where it matters. The position information used internally by the AI model is adjusted for each tile's location in the full image, which the README notes is important for the Flux2.Klein model to work correctly.

The README includes a candid disclaimer: the author wrote no code themselves. The entire plugin was built by giving instructions to AI assistants, and the author acknowledges they would not be able to fix bugs on their own. Users encountering problems are advised to paste the source file and error messages into an AI assistant for help.

Installation involves cloning the repository into ComfyUI's custom nodes folder and restarting the application. The plugin then appears as a draggable node in the ComfyUI workflow editor. The README describes settings for tile size calculation mode, tile processing order strategy, color matching, adaptive step reduction for flat areas, and a tiled decode option for very large output resolutions.

Where it fits