For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /nodes/05/ResizeAndPadImage.md.

调整尺寸并填充图像(ResizeAndPadImage)

ResizeAndPadImageimage/transform角色:图像处理

ResizeAndPadImage 节点用于将图像调整至指定尺寸范围内,同时保持原始宽高比。它会按比例缩小图像以适配目标宽度和高度,然后在边缘添加填充以填补剩余空间。填充颜色和插值方法可自定义,以控制填充区域的外观和缩放质量。

参数

参数类型默认 / 范围说明
imageIMAGE · 图像—(连线输入)RGB 图像输入;尺寸不一致会被缩放或裁切。
target_widthINT1 ~ 16384—
target_heightINT1 ~ 16384—
padding_colorCOMBOwhite、black框与内容之间的留白。
interpolationCOMBOarea、bicubic、nearest-exact、bilinear …共 5 项—

输出

输出类型说明
IMAGEIMAGE图像

怎么接

  • 上游:LoadImage / VAEDecode
  • 下游:VAEEncode / SaveImage / 下一个图像节点
  • 接线:接在 LoadImage 或 VAEDecode 之后,处理结果再交给 VAEEncode(重绘)、SaveImage(出图)或下一个图像节点;这类节点可以任意串联成处理流水线。

使用案例

属于「图像处理」类节点,向下游提供图像数据。从 image、target_width(512)、target_height(512) 开始填就能跑起来。典型接法:LoadImage → 本节点 → VAEEncode。输出类型是 IMAGE,只能接同类型的输入端口,颜色对不上就是接错了。

端口与连线示意

ResizeAndPadImage 端口与连线示意

同类节点

裁剪图像 · 按遮罩裁剪图像 · 图像翻转 · 外补画板 · 图像旋转 · 图像拼接 · 裁剪图像(中心) · CropByBBoxes · 图像裁剪 · 裁剪图像(随机) · 调整图像/掩码大小 · 缩放图像(长边)