AddBorders

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
m (1 revision)
m (added category)
Line 18: Line 18:
  
 
[[Category:Internal filters]]
 
[[Category:Internal filters]]
 +
[[Category:Borders_and_Cropping]]

Revision as of 15:25, 8 November 2015

AddBorders(clip clip, int left, int top, int right, int bottom [, int color])

AddBorders adds black (or specified color) borders around the image, with the specified widths (in pixels). YV12/YUY2 format only stores color information for every two pixels horizontally, so if you're processing in YV12/YUY2 mode, left and right must be even.

The color parameter is optional (added in v2.07), default=0 <black>, and is specified as an RGB value regardless of whether the clip format is RGB or YUV based. Color presets can be found here: color presets. See Colors for more information on specifying colors.

Be aware that many lossy compression algorithms don't deal well with solid-color borders, unless the border width happens to be a multiple of the block size (16 pixels for MPEG).

You can use this filter in combination with Crop to shift an image around without changing the frame size. For example:

# Shift a 352x240 image 2 pixels to the right
Crop(0, 0, 350, 240)
AddBorders(2, 0, 0, 0)
# Add letterbox borders that are Black making a 720x308 image 720x480
# For YUV colorspace it will be correct (for CCIR-601) color (luma=16)
AddBorders(0, 86, 0, 86, $000000)
Personal tools