Nodes Browser

ComfyDeploy: How SD3-Scaling works in ComfyUI?

What is SD3-Scaling?

Tools for scaling images and latents appropriate to SD3 in ComfyUI.

How to install it in ComfyDeploy?

Head over to the machine page

  1. Click on the "Create a new machine" button
  2. Select the Edit build steps
  3. Add a new step -> Custom Node
  4. Search for SD3-Scaling and select it
  5. Close the build step dialig and then click on the "Save" button to rebuild the machine

SD3-Scaling

Tools for scaling images and latents appropriate to SD3 in ComfyUI

SD3 Image Scale To Total Pixels

This custom node is a wrapper for the builtin ImageScaleToTotalPixels that works within the desired constraint of SD3 to operate on images whose width and height are divisible by 64.

Generally only use this node when scaling an input image intended to be passed to a sampler (img2img) as the SD3-specific resolution only applies to sampler inputs.

Inputs:

  • upscale_method—(inherited from ImageScaleToTotalPixels) see ComfyUI docs
  • megapixels—(inherited from ImageScaleToTotalPixels) the desired total megapixels of the resulting image, see below

Outputs:

  • image—The scaled image

SD3 wants input latents that have width and height divisible by 64. To meet this requirement, when scaling to a specific megapixel resolution, the resulting width and height are checked and reduced to the nearest value that is divisible by 64.

Because no cropping is performed, some stretching may occur if either dimension needs to be reduced. Since you should be working at at least the megapixel range for your input image with SD3, this probably won't be noticable, but you should be aware that this will occcur.