787633258 写了:vs内建的resize的话,用src_left, src_top, src_width, src_height来控制裁剪范围
如果写成vs内建的Crop(CropRel)的那种形式的话,就是:
然后rcrop(clip,left,top,right,bottom)调用就行了
感谢回复,电脑出了点问题,所以我的回复晚了一点,不好意思
vs内建resize
src_left, src_top, src_width, src_height 这几个参数很奇怪
Used to select the source region of the input to use. Can also be used to shift the image. Defaults to the whole image.
实际效果是切了画面但在切去画面的部分又补上镜像画面,不知该怎么用才对
使用你写的这段可以切奇数,但依旧需要左右(或上下)所切之和为偶数
比如 rcrop(clip,5,0,5,0) 是可以的
但 rcrop(clip,5,0,4,0) 就报错了
无法实现AVS下类似 LanczosResize(648,480,4,0,-5,0).crop(4,0,-4,0) 的操作
我具体是这样用的,不知有未用错
代码: 全选
def rcrop(clip,left=0,top=0,right=0,bottom=0):
if left<0:
raise ValueError("rcrop:left mustn't be negative")
if right<0:
raise ValueError("rcrop:right mustn't be negative")
if top<0:
raise ValueError("rcrop:top mustn't be negative")
if bottom<0:
raise ValueError("rcrop:bottom mustn't be negative")
return clip.resize.Point(clip.width-left-right,clip.height-top-bottom,src_left=left, src_top=top, src_width=clip.width-left-right, src_height=clip.height-top-bottom)
src = rcrop(src,5,0,4,0)