Project: r/place timelapses - Chapter2
Read First: Chapter 1
Start to process the raw data⌗
After the first dump, I started working on a script to create timelapses from the raw images (I’ll continue on that in chapter 3).
Still searched for the full raw data and messaged u/TCOOfficiall who linked me to an archive. I downloaded the full collection of raw images which luckily had a logic naming scheme.
The full canvas were split in 6 parts, like this:
0 | 1 | 2 |
---|---|---|
3 | 4 | 5 |
And on the actual canvas - like this:
And files were named epochtime-area.png
- example:
1689903000-0.png
1689903000-1.png
1689903000-2.png
1689903000-3.png
1689903000-4.png
1689903000-5.png
So that way I could just combine all 6 splits to one single canvas with this:
montage 1689903000-0.png 1689903000-1.png 1689903000-2.png 1689903000-3.png 1689903000-4.png 1689903000-5.png -geometry +0+0 montage1.png
# Worked! Next I needed to create a list of all timestamps to iterate over:
ls -1 *.png | sed 's/......$//' | uniq > list
- list all the png’s, one line per file
- remove the trailing
-0.png
, - remove the duplicate lines
- write it to the file
list
. - Note:
- the “images2” directory has reverse naming
0-1689903000.png
- change to this:
ls -1 *.png | sed -e 's/^..//;s/....$//' | uniq > list
- the “images2” directory has reverse naming
Iteration!⌗
Loop over every timestamp(filename) to create a single canvas per timestamp:
while read -r line
do
montage ${line}-0.png ${line}-1.png ${line}-2.png ${line}-3.png ${line}-4.png ${line}-5.png -geometry +0+0 montage_${line}.png
done < list
Though the canvas area grew over time from the center outwards, so prior to the start of the last period the outer splits were just not created.
This is how the canvas grew - and as you can see, it’s not within the same boundaries as the splits above.
So I’d have 1689903000-1 1689903000-2 1689903000-3 1689903000-4
and missing 0 and 5.
This lead to trouble when merging all images of every timestamp to a single file, as I needed the “empty” areas filled to keep aspect ratio constant.
Next step - create a filler⌗
..to fill where files are missing (due to empty splits).
while read -r line
do
[[ -f ./${line}-0.png ]] && canvas_0="./${line}-0.png" || canvas_0="xc:white"
[[ -f ./${line}-1.png ]] && canvas_1="./${line}-1.png" || canvas_1="xc:white"
[[ -f ./${line}-2.png ]] && canvas_2="./${line}-2.png" || canvas_2="xc:white"
[[ -f ./${line}-3.png ]] && canvas_3="./${line}-3.png" || canvas_3="xc:white"
[[ -f ./${line}-4.png ]] && canvas_4="./${line}-4.png" || canvas_4="xc:white"
[[ -f ./${line}-5.png ]] && canvas_5="./${line}-5.png" || canvas_5="xc:white"
montage ${canvas_0} ${canvas_1} ${canvas_2} ${canvas_3} ${canvas_4} ${canvas_5} -geometry 1000x1000+0+0 ./MONTAGE/${line}.png
done < list
[[ -f ./${line}-0.png ]]
checks if the file exists.- If it’s there, sets the variable
canvas_0
to that file, otherwise to"xc:white"
xc:white
just fills the space with blank white.
Final montage loop - cleaned it up a little.⌗
while read -r line
do
for num in {0..5}
do
[[ -f ./${num}-${line}.png ]] && declare canvas_${num}="./${num}-${line}.png" || declare canvas_${num}="xc:white"
done
montage ${canvas_0} ${canvas_1} ${canvas_2} ${canvas_3} ${canvas_4} ${canvas_5} -geometry 1000x1000+0+0 ./MONTAGE/${line}.png
done < list
- for every line in the list, loop it over 0-5 numbers.
- check if filename exist (epoch-timestamp+number)
- if the file is missing, set that canvas split to fill blank white.
- stitch together all 6 pieces.
Done with this chapter, raw images are ready to be timelapsed!⌗
Read more in Chapter 3