AddBorders
From Avisynth wiki
(Difference between revisions)
Raffriff42 (Talk | contribs) m (correction) |
Raffriff42 (Talk | contribs) m (one more touch-up) |
||
Line 1: | Line 1: | ||
Add black or colored borders, increasing frame size. | Add black or colored borders, increasing frame size. | ||
+ | == Syntax and Parameters == | ||
{{FuncDef | {{FuncDef | ||
|AddBorders( clip ''clip'', int ''left'', int ''top'', int ''right'', int ''bottom'' [, int ''color'' ] ) | |AddBorders( clip ''clip'', int ''left'', int ''top'', int ''right'', int ''bottom'' [, int ''color'' ] ) | ||
Line 7: | Line 8: | ||
:{{Par2|left, top, right, bottom|int|(required)}} | :{{Par2|left, top, right, bottom|int|(required)}} | ||
::Border width in pixels. | ::Border width in pixels. | ||
− | ::For [[YUY2]] sources, {{FuncArg|left}} and {{FuncArg|right}} must be | + | ::*For [[YUY2]] sources, {{FuncArg|left}} and {{FuncArg|right}} must be [[Modulo|mod2]] (divisible by 2). |
− | ::For [[YV12]] sources, | + | ::*For [[YV12]] sources, all four border widths must be mod2. |
:{{Par2|color|int|(black)}} | :{{Par2|color|int|(black)}} | ||
::Border color; specified as an RGB value. See [[Colors|this page]] for more information on specifying colors. | ::Border color; specified as an RGB value. See [[Colors|this page]] for more information on specifying colors. | ||
− | ::For YUV clips, colors are converted from full-range (0–255) to tv-range (16–235). | + | ::*For YUV clips, colors are converted from full-range (0–255) to tv-range (16–235). |
− | + | ||
+ | == Examples and Notes == | ||
<div style="max-width:54em" > | <div style="max-width:54em" > | ||
* Add ''letterbox'' (top and bottom) borders: | * Add ''letterbox'' (top and bottom) borders: |
Revision as of 09:03, 30 January 2016
Add black or colored borders, increasing frame size.
Syntax and Parameters
AddBorders( clip clip, int left, int top, int right, int bottom [, int color ] )
- int left, top, right, bottom = (required)
- int color = (black)
- Border color; specified as an RGB value. See this page for more information on specifying colors.
- For YUV clips, colors are converted from full-range (0–255) to tv-range (16–235).
- Border color; specified as an RGB value. See this page for more information on specifying colors.
Examples and Notes
- Add letterbox (top and bottom) borders:
## add dark blue borders, using hex color notation AddBorders(0, 86, 0, 86, $00008B) ## same as above, using named preset color AddBorders(0, 86, 0, 86, color_darkblue)
- Be aware that many older lossy compression algorithms don't deal well with solid-color borders, unless the border happens to fall on a macroblock boundary (16 pixels for MPEG).
- Use AddBorders in combination with Crop to shift an image without changing the frame size:
# Shift an image 2 pixels to the right Crop(0, 0, Width-2, Height) AddBorders(2, 0, 0, 0)
- Note, shifting this way with YUV clips must be done in 2-pixel increments.
- You can shift in sub-pixel increments with Resize.