Log in

View Full Version : CropVD.avsi - Virtualdub2 style cropping


toot367
16th December 2020, 07:40
I don't know how everyone handles the standard Crop parameters with the negative numbers and bizarre ordering. My brain won't work with it so, here's my first function for Avisynth. The parameters are just like in Virtuadub2's crop with left, right, top, bottom.
Example:
Crop 2 pixels left, 4 pixels right, 0 on the top, and 10 on the bottom:
CropVD(2,4,0,10)

CropVD.avsi

# CropVD 1.0 by videogeek
#
# VirtualDub style cropping- pixels from the border
# with the VDub order left,right,top,bottom and no negative numbers
# Note as this is using the Avisynth Crop function, the same Mod rules apply:
#
#Colorspace Width Progressive Height Interlaced Height
#--------------------------------------------------------------
# RGB no restriction no restriction mod-2
# YUY2 mod-2 no restriction mod-2
# YV12 mod-2 mod-2 mod-4
# YV411 mod-4 no restriction mod-2
# YV16 mod-2 no restriction mod-2
# YV24 no restriction no restriction mod-2
#
# version 1.0 2020-11-20 first release

function CropVD(clip C, int "left", int "right", int "top", int "bottom" )
{
C = default(C, C)
left = default(left, 0)
right = default(right, 0)
top = default(top, 0)
bottom = default(bottom,0)

return Crop( C, left, top, -right, -bottom )
}


Download CropVD.avsi and copy to your Avisynth plugins folder:
https://mega.nz/file/lxc3nIZY#qXGyyTp5ctGsQjGIuNLRIX4jhFl074U_7OXYt_t7N68