Notizbl0g.

h4cking, ham radio, fire fighting and m0re

Image Grid From SSTV Pictures

During January 2019 there were two weekends with SSTV activity from ISS. As it would be nice to have all received images in a grid I amde a little shell script to accomplish this. You just need to rename the input picture according to the numbers of the images like 01_whatsoever.png. Missing images will be replaced by a dummy saying “picture missing”. Output is a file named output.png. The script assumes that input image size is 640x496 pixels and output is hardcoded 2560x1488. An output example:

Click me.
Click the image for a larger view.

And here is the script code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh
#
# v0.1 Florian Wolters DF2ET
#
# This script takes 12 input images named 01_something, 02_something ...
# and alignes them in a 4x3 matrix. Missing pics will be replaced by a 
# dummy

convert -size 2560x1488 xc:transparent output.png
x=0;
y=0;
for file in 01_* 02_* 03_* 04_* 05_* 06_* 07_* 08_* 09_* 10_* 11_* 12_*; do
   if [ -f $file ]; then
      echo "$file placed @ x: $x; y: $y"
   else
      if [ ! -f temp.png ]; then
         convert -size 640x496 xc:black temp.png
         convert temp.png -font Arial -weight 700  -pointsize 80 -draw "rotate -45 gravity center fill yellow text 0,0 'picture missing' " temp.png
      fi
      file="temp.png"
      echo "inserting dummy @ x: $x; y: $y"
   fi
   composite -geometry 640x496+$x+$y $file output.png output.png
   if [ "$x" -lt "1920" ]; then
      x=$(echo "$x + 640" | bc)
   else
      y=$(echo "$y + 496" | bc)
      x=0
   fi
done
rm -f temp.png
exit 0