-
Notifications
You must be signed in to change notification settings - Fork 0
Bash scripts and commands
#! /bin/bash
appPath="<path_to_pde>"
echo "Start:"
for i in `seq 1 50`; do
# ${appPath}
processing-java --sketch=${appPath} --run
echo "Run num ${i} done."
done
echo "All done!"
Please be sure to replace the appPath
in the script. It should also be made sure that the processing script exits on its own.
On MacOS: Processing -> Tools -> Install "processing-java"
On Ubuntu, processing-java is included in tar file. To match, the processing-java --sketch=${appPath} --run
should be changed to reflect the location of processing-java file. Make sure to avoid using ~
and write the full path. For e.g. on Alienware it would be /home/conditionalstudio/processing-3.3.7/processing-java --sketch=${appPath} --run
.
concatResizedEdges.sh
was used to concatenate the edge images of Persona with the resized to 351x256 Persona images. This is a script with a very specific usage, however parts of the script may be useful for other similar purposes.
./concatResizedEdges.sh 7 2 2000 3999
The script takes in 4 parameters. First 7
refers to Frames-07-resized
. 2
points to the sub-folder 02
inside Frames-07-resized
. Third parameter 2000
points to the starting image Persona-07-02000.jpg
and 3999
points to the last image in folder Persona-07-03999.jpg
. All together the command concatenates images Frames-07-resized/Persona-07-<num>.jpg
with Frames-07-edges/Persona-07-<num>.jpg
with <num>
being numbers 02000-03999 in directory Frames-07-resized/02
and outputs them in Frames-07-resized-edges
.
#! /bin/bash
folderNum=$1
subDirNum=$2
startNum=$3
endNum=$4
folderNumStr=$(printf "%02g" $folderNum)
subDirNumStr=$(printf "%02g" $subDirNum)
resizedDir="Frames-${folderNumStr}-resized/${subDirNumStr}"
edgesDir="Frames-${folderNumStr}-edges"
outputDir="Frames-${folderNumStr}-resized-edges"
for i in `seq $startNum $endNum`; do
numStr=$(printf "%05g" $i)
imgName="Persona-${folderNumStr}-${numStr}.jpg"
resizedPath="${resizedDir}/${imgName}"
edgePath="${edgesDir}/${imgName}"
outputImgPath="${outputDir}/${imgName}"
convert ${resizedPath} ${edgePath} +append -quality 100 ${outputImgPath}
if ! ((i % 100)); then
echo "${imgName} done."
fi
done
echo "All done!"
When working with a huge number of images, usual commands like ls
takes a loooong time to return or outright refuse to run. Here are some handy commands that work and take considerably less amount of time.
ls -f | wc -l
The number of files is the number printed - 3. For e.g. if output is 2463, the number of files in the directory is 2460. Depending on the number of images, it can be quite slow to run. -f option makes ls
not sort the files.
ls -la | head -<number_of_lines>
This command is useful for getting the naming convention of the image files in a directory. For e.g. with Persona it will list "Persona-01-00000.jpg Persona-01-00001.jpg Persona-01-00002.jpg ..."
ls -la | tail -<number_of_lines>
Combined with ls -la | wc -l
this command is useful for checking for missing images.