ComfyUI: Cómo redimensionar imágenes manteniendo el contexto original

The article begins by exploring the user’s initial request to create a simple ComfyUI workflow that resizes an image to 1280×720 while keeping the original content locked and only applying modifications to the new areas. The discussion quickly reveals that ComfyUI does not natively «lock» pixels during resizing; instead, it requires generating a white/black mask where black represents the protected original image.

Interfaz de software mostrando nodos de IA conectados entre sí.
Visualización del flujo de trabajo en ComfyUI para redimensionar y mantener el contexto.

El flujo inicial y la máscara

The article details how to assemble this initial workflow using standard nodes like Load Image, Image Scale set to «fit» mode, and Empty Image. It explains the logic of composing the scaled image over a background canvas and generating a mask where black zones represent the original content that must not be touched.

Código JSON del workflow básico

The conversation then provides a complete JSON snippet for this basic setup, allowing users to import it directly into ComfyUI. The code demonstrates the connections between Load Image, ImageScale, and the initial mask generation steps.

Problemas de contexto y soluciones avanzadas

The article then shifts focus when the user realizes that the resized content in the new areas looks nothing like the original image. The discussion identifies this as a lack of context, where the model simply re-invents details based on its prompt rather than extending the actual scene.

Ajustes para mantener la coherencia

To solve this, the article outlines several advanced techniques: lowering the denoise parameter to 0.35–0.55 so the model extends rather than reinvents; using highly descriptive prompts that instruct the AI to «continue» the scene; and implementing ControlNet with a Canny preprocessor for structural coherence.

Optimizando el inpainting

The discussion also highlights the importance of blurring the mask (using a Blur Mask) to avoid hard cuts between the original and new areas, as well as using «context aware» options in samplers. The article concludes by suggesting that while ControlNet provides high-quality results, it is possible to achieve decent outcomes without it.