View Full Version : How organize loop for reading set of still image
Hi all!
How organize loop for reading set of still image.
Script for reading one image
ImageSource("Негатив - 001 - (А)res.tif", end = 0,fps=25, use_DevIL=true)
w=width()
h=height()
hn=576
wn=round(w*576/h*540/576)
al=round((720-wn)/2)
ar=720-wn-al
Spline64Resize(wn,hn)
FlipVertical()
AddBorders(al,0,ar,0)
ConvertToYUY2(interlaced=false).TNLMeans()
ColorYUV(levels="PC->TV")
Loop(250)
yup.
Gavino
11th July 2011, 09:06
Make your code into a function and call it for each image:
function Image(string file) {
ImageSource(file, end = 0, fps=25, use_DevIL=true)
w=width()
h=height()
hn=576
wn=round(w*576.0/h*540/576)
al=round((720-wn)/2.0)
ar=720-wn-al
Spline64Resize(wn,hn)
FlipVertical()
AddBorders(al,0,ar,0)
ConvertToYUY2(interlaced=false).TNLMeans()
ColorYUV(levels="PC->TV")
Loop(250)
}
Image("Негатив - 001 - (А)res.tif")
\ + Image("... file2 ...")
\ + ...
I have changed the calculations of wn and al to ensure floating point division is used.
A separate instance of ImageSource is used for each image. If the images are all the same size, a different solution reading them as a sequence with a single ImageSource would be possible.
Gavino:thanks:
It work.
We can not organize for loop cycle in Avisynth script?
yup.
Chikuzen
11th July 2011, 11:50
We can not organize for loop cycle in Avisynth script?
function Image(string file, int "times") {
ImageSource(file, end = 0, fps=25, use_DevIL=true)
w=width()
h=height()
hn=576
wn=round(w*576.0/h*540/576)
al=round((720-wn)/2.0)
ar=720-wn-al
Spline64Resize(wn,hn)
FlipVertical()
AddBorders(al,0,ar,0)
ConvertToYUY2(interlaced=false).TNLMeans()
ColorYUV(levels="PC->TV")
Loop(default(times,250))
}
Image("Негатив - 001 - (А)res.tif",425)
\ + Image("... file2 ...",125)
\ + ...
btw,ColorYUV(levels="PC->TV")
why did you write this line?
levels are already TV scale at ConvertToYUY2().
Gavino
11th July 2011, 14:54
We can not organize for loop cycle in Avisynth script?
If your file names have a regular form that can be varied with a loop index, you can use GScript:
Image("Негатив - 001 - (А)res.tif")
GScript("""
for (n=2, nImages) {
last + Image(string(n, "Негатив - %03.0f - (А)res.tif"))
}
""")
Chikuzen :thanks:
Thanks for advice. I do not read ConvertYUY2 doc (Rec601 default matrix).
Gavino I am try find time for reading about GScript.
yup.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.