View Single Post
Old 21st November 2020, 19:32   #1  |  Link
dark76
Registered User
 
Join Date: Sep 2016
Location: Rome, Italy
Posts: 18
Help with generating video from cropped images

Hello,
Probably stupid question, I try to explain what I'm trying to do (my english is quite bad, sorry)
I have a folder with multiple images. I want to cut/split/crop them in 3 parts and then joining what I get to generate a video. For example let's say I have "picture1" and "picture2" in the folder (same height and width)... I want to generate a video from "top_picture1", "middle_picture1", "bottom_picture1", "top_picture2", "middle_picture2", "bottom_picture2".

I looked in the forum and imitating other scripts (basically from Stainless, i think) I came to the point that i wrote a function which work for a single picture but I'm not able to make it work recursevely.

The function is this,

Code:
function croppaunisci(clip immagine)
{
larghezza=Width(immagine) #width
altezza=Height(immagine) #height


croppato=altezza/3  #height/3

sopra1=crop(immagine,0,0,0,croppato) #top of the picture
centro2=crop(immagine,0,croppato,0,croppato) # middle of the picture
sotto3=crop(immagine,0,croppato*2,0,croppato) # bottom of the picture
 
sopra1++centro2++sotto3  #  join the parts

}
Then I wrote this but it doesn't work cause I don't know how to append what I get from the cycle.

Code:
IN_FILES = "C:\pathwithimages\*.jpg"   # Added '|' Pipe separator for multiple Wildcard in Extensions ONLY.
OUT_FILE    = "FILE.List"   # Dont need to change really, just a name.
result=RT_WriteFileList(IN_FILES,OUT_FILE)                                  # Create a listing file of Pic files
    Assert((result!=0), "No files found")
    FILELIST=RT_ReadTxtFromFile(OUT_FILE)                                       # Get list of files
    FILES=RT_TxtQueryLines(FILELIST)                                            # Query Number of lines in String ie number of files.


    For(i=0,FILES-1) {
        FN=RT_TxtGetLine(FILELIST,i)                                            # Filename 
       immagine=Imagesource(FN,end=0,fps=25)
       a=croppaunisci(immagine)
       return a + a
         
       
        }

The part "return a+a" is obviously non-sense, i know, but how should i correct it?
Using avisynth+ 3.61, windows 7 32 bit.
Thx for the attention!

Last edited by dark76; 21st November 2020 at 21:18. Reason: typo
dark76 is offline   Reply With Quote