Serranya
6th October 2012, 23:41
Hello,
i have a clip with a 4:3 DAR, and want it to change to 19:9 for YouTube.
Since i dont want to deform my clip, i add fancy Borders to the left and the right to the clip like this:
http://i.imgur.com/UuW1S.jpg
here is my script:
function RealtimeBorderResize(clip src, int targetBorderWidth, int targetHeight)
{
copy = src
newWidth = Width(src) * targetHeight / Height(src)
copy = BicubicResize(copy,newWidth,targetHeight)
resized = copy
borderWidth = (targetWidth - Width(resized)) / 2
copy = AddBorders(copy, borderWidth,0,borderWidth,0)
leftBorder = Crop(resized,0,0,borderWidth,0)
rightBorder = Crop(resized,newWidth-borderWidth,0,0,0)
copy = Overlay(copy,leftBorder,0,0)
copy = Overlay(copy,rightBorder,targetWidth-borderWidth,0)
return copy
I want to ask, if you know any way, to optimize this code
in order to let the script run faster.
regarts Serra
i have a clip with a 4:3 DAR, and want it to change to 19:9 for YouTube.
Since i dont want to deform my clip, i add fancy Borders to the left and the right to the clip like this:
http://i.imgur.com/UuW1S.jpg
here is my script:
function RealtimeBorderResize(clip src, int targetBorderWidth, int targetHeight)
{
copy = src
newWidth = Width(src) * targetHeight / Height(src)
copy = BicubicResize(copy,newWidth,targetHeight)
resized = copy
borderWidth = (targetWidth - Width(resized)) / 2
copy = AddBorders(copy, borderWidth,0,borderWidth,0)
leftBorder = Crop(resized,0,0,borderWidth,0)
rightBorder = Crop(resized,newWidth-borderWidth,0,0,0)
copy = Overlay(copy,leftBorder,0,0)
copy = Overlay(copy,rightBorder,targetWidth-borderWidth,0)
return copy
I want to ask, if you know any way, to optimize this code
in order to let the script run faster.
regarts Serra