View Full Version : How to apply ImageSource to all images in folder?
zapp7
13th May 2020, 17:37
I'm loading a sequence of .png images with ImageSource. The default value for start and end is 0 and 1000. In my workflow there will always be more than 1000 images, and the total number of images will vary.
Is there a way for ImageSource to just load all images in a folder without having to manually edit the "end" parameter?
StainlessS
13th May 2020, 18:32
This should work, assumes that start is always 0.
Req RT_Stats, v1.43+.
/*
From RT_Stats,
RT_WriteFileList(String,String,bool "append"=false)
Non-clip function.
This function, takes as the first string, a filename template with wildcards, this template can be eg
"Fred.jpg" or "Fr?d.jp*g". where the '?' character matches any single character and the '*' wildcard matches zero or more characters.
v1.03, Can take multiple pipe ('|') separated Wilcards in the extension ONLY, as in "D:\Pics\*.BMP|JP*G|PNG"
The second string is the output filename which will be created and contain the files matching the input file template.
The function will return the number of filenames written into the output file. Directories are ignored altogether
and not written to the output file. A return of -1 indicates a problem opening/writing the output file.
v1.06, Append, if true appends to existing file. NOTE, the return value does NOT include any already existing
filenames if append is true (use RT_FileQueryLines to inquire total number of filenames when append = true).
*/
IFN = ".\Pic\myFile_*.bmp" # relative current directory
TmpFile = ".\TmpFileList.tmp"
IFN = RT_GetFullPathName(IFN) # Get full path filename
TmpFile = RT_GetFullPathName(TmpFile)
FileCnt = RT_WriteFileList(IFN,TmpFile) # write list of files, returning count of files found
Assert(FileCnt > 0, "Problem getting image filecnt")
RT_FileDelete(TmpFile) # Finished with file list
ImageSource(".\Pic\myFile_%06d.bmp",Start=0,end=FileCnt-1) # Filecnt - 1 because Start=0
Return Last
EDIT: Script used to create test clips.
Colorbars
trim(0,-100)
ShowFrameNumber
OFN = "D:\TMP\Pic\myFile_%06d.bmp"
ImageWriter(OFN, type = "bmp")
zapp7
13th May 2020, 21:25
This should work, assumes that start is always 0.
Req RT_Stats, v1.43+.
/*
From RT_Stats,
RT_WriteFileList(String,String,bool "append"=false)
Non-clip function.
This function, takes as the first string, a filename template with wildcards, this template can be eg
"Fred.jpg" or "Fr?d.jp*g". where the '?' character matches any single character and the '*' wildcard matches zero or more characters.
v1.03, Can take multiple pipe ('|') separated Wilcards in the extension ONLY, as in "D:\Pics\*.BMP|JP*G|PNG"
The second string is the output filename which will be created and contain the files matching the input file template.
The function will return the number of filenames written into the output file. Directories are ignored altogether
and not written to the output file. A return of -1 indicates a problem opening/writing the output file.
v1.06, Append, if true appends to existing file. NOTE, the return value does NOT include any already existing
filenames if append is true (use RT_FileQueryLines to inquire total number of filenames when append = true).
*/
IFN = ".\Pic\myFile_*.bmp" # relative current directory
TmpFile = ".\TmpFileList.tmp"
IFN = RT_GetFullPathName(IFN) # Get full path filename
TmpFile = RT_GetFullPathName(TmpFile)
FileCnt = RT_WriteFileList(IFN,TmpFile) # write list of files, returning count of files found
Assert(FileCnt > 0, "Problem getting image filecnt")
RT_FileDelete(TmpFile) # Finished with file list
ImageSource(".\Pic\myFile_%06d.bmp",Start=0,end=FileCnt-1) # Filecnt - 1 because Start=0
Return Last
EDIT: Script used to create test clips.
Colorbars
trim(0,-100)
ShowFrameNumber
OFN = "D:\TMP\Pic\myFile_%06d.bmp"
ImageWriter(OFN, type = "bmp")
That did the trick. Thank you!
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.