Sign In

Upscale image to selected megapixel size

4

Nov 2, 2025

(Updated: 5 months ago)

workflows
Upscale image to selected megapixel size

Two convenient ComfyUI workflows for upscaling images to a selected size in megapixels (MP).

The first one, Upscale_to_MP (model), uses a method suggested by Gemini - first use an upscaler model, then use "Scale Image to Total Pixels" node with a simple interpolation to achieve desired size.

The second one, FlexibleUpscale to MP, uses Ultimate SD Upscale and a SD1.5-compatible checkpoint to achieve the same result.

Use them as follows:

  • Install any missing nodes using ComfyUI Manager. Note that Reactor nodes must be manually installed from the Github repository (https://github.com/Gourieff/comfyui-reactor). Note also that I am using comfyui-reactor-node, not comfyui-reactor (however Reactor Face Restore node is available in both versions) - change if necessary.

  • Load an image into "Load Image" (green) node.

  • Select an appropriate upscaler (and a SD checkpoint for the second workflow). If unsure, start with ESRGAN x 4 or 4x-Ultrasharp that can be installed using ComfyUI Manager ("Model Manager", type "upscale"). I am using Deliberate V6 as my checkpoint for the second workflow, but any other SD1.5-based model can be used. Feel free to experiment.

  • Select the target image size in megapixels in "Required Megapixels" (blue) node.

  • (optionally) For artifacts (dither etc.) removal, restore the bypass status for nodes in DeJPG group. Use an appropriate 1x denoising upscaler, depending on the artifacts you want to remove. Note that some upscalers (e.g. FaceUpxxx) also remove artifacts when used.

  • By default, both workflows use original image filename for the output image. If you want to prefix the filename with "Upscaled-", toggle the switch in "Save As 'Upscaled-...?" (in the Filename Logic group) to "true". You can change the prefix by editing the String node in this group. Note that this feature bypasses standard ComfyUI filename prefix logic - the images will be saved in the selected (sub-)folder, but their filenames would not be prefixed with any string from the Save Image "filename prefix" field.

  • Run the workflow.

Note that for best results the scaling factor of an upscaler should be (sligthly) larger than required scaling factor. Slight deviations are OK (eg. scaling factor of 4.19 for 4x upscaler). Experiment for best results.

Also note that I am using Reactor nodes to restore faces after upscaling, however some users may find it superfluous.

You can use any upscaler model that fits the purpose.

Have fun.

4