Log in

View Full Version : Is this a bug in avisynth or my code ?


spektant
13th February 2011, 01:00
Hi, I am new to this forum and Avisynth so I might be wrong but for me merging 2 frames with equal size never works. I have similar code this one is for simplicity -


SetMTMode(2,0)
video = DirectShowSource("D:\some_clip.avi")

frame1 = video
frame2 = video

frame1=Crop(frame1,0,0,28,0,false).AddBorders(0,0,28,0)

frame2=Crop(frame2,28,0,0,0).AddBorders(28,0,0,0)

Merge(frame1,frame2, weight=0.50)

Error says - Merge: Images must have same width and height

If you do the math lets say my clip is 625x352. What my code does (or I think it does) is crop 28 pixels from right part of frame 1 and add 28 pixels black border on their place. Same on frame2 but this time on the left side.

math says - 625-28+28=625 both for frame 1 and 2 , but merge fails due to some reason, and my width should be equal indeed.

poisondeathray
13th February 2011, 01:10
the crop should be negative for the 1st

instead of
frame1=Crop(frame1,0,0,28,0,false).AddBorders(0,0,28,0)

it should be
frame1=Crop(frame1,0,0,-28,0,false).AddBorders(0,0,28,0)

crop arguments are (left, top , -right, -bottom)

spektant
13th February 2011, 01:16
LOL nice i used newbies part of the forum.

TY poisondeathray works like a charm. Did not expect "-" values are alowed. Gotta read for every function I guess :)

Gavino
13th February 2011, 10:27
There are two ways to specify the bottom right cropping point.
A negative (or zero) value means crop this amount off the right or bottom:
Crop(left, top, -right, -bottom)

A positive value here means make this the width or height:
Crop(left, top, width, height)