Image Padding

This function block adds a constant-color border (padding) around an image. Use it to create margins, unify image sizes, or prepare images for concatenation and layout tasks without altering the original content.

πŸ“₯ Inputs

Input Image The image to which padding will be applied.

Padding Size A number specifying how many pixels to add (applied according to the chosen side).

Color A pixel color value (B, G, R) used as the padding fill color. If not provided, black is used.

πŸ“€ Outputs

Padded Image The resulting image with the added padding.

πŸ•ΉοΈ Controls

Padding Side Choose which side(s) the padding should be applied to. Available options

  • ALL

  • VERTICAL

  • HORIZONTAL

  • LEFT

  • RIGHT

  • TOP

  • BOTTOM

This control determines where the padding pixels are added relative to the input image.

🎨 Features

  • Fixed-color border applied anywhere around the image.

  • Flexible side selection to pad only needed edges.

  • Accepts a pixel color input so you can match backgrounds or highlight margins.

πŸ“ Usage Instructions

  1. Provide an image to Input Image.

  2. Enter the number of pixels in Padding Size to define the border width.

  3. Optionally feed a color into Color (format: (Blue, Green, Red)). If left empty, the padding will be black.

  4. Select the desired side with Padding Side and run the scenario to get Padded Image.

πŸ“Š Evaluation

When executed, this block returns the image with the padding applied according to the chosen side, size, and color. Use the output directly in downstream visualization or processing blocks.

πŸ’‘ Tips and Tricks

  • To make multiple images the same canvas size for visual comparison, first use Image Resize to match heights or widths, then use this block to add symmetric padding so all images align visually.

  • If you want to focus on a cropped region and then add a background, combine Image ROI Select (to crop) β†’ this block (to add border) β†’ Show Image to preview the result.

  • To create margins before combining images side-by-side, add padding and then use Image Concatenate or Collage Images to assemble a clean layout.

  • Use Make Image to create a colored background and then use this block when you need extra margins that match a specific background color.

  • Save padded results automatically by connecting Padded Image to Image Logger or Image Write.

(hint) When providing color, remember the system expects pixel values in BGR order.

πŸ› οΈ Troubleshooting

  • If the padding appears in an unexpected color, confirm the Color input is provided as (Blue, Green, Red) and values are within 0–255.

  • If no change is visible, ensure Padding Size is greater than zero and that the correct Padding Side option is selected.

  • When combining many images after padding, check final alignment with Show Image to verify spacing and border consistency.

Last updated

Was this helpful?