-
Notifications
You must be signed in to change notification settings - Fork 0
/
composite_tiles2
executable file
·71 lines (58 loc) · 2.04 KB
/
composite_tiles2
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
source ./config
MAGICK='imagemagick'
# https://imagemagick.org/Usage/layers/
# composite
# works for canopy (base):
# for ZDIR in $TILE_DIR/contours_mask/* ; do
# Z=`basename $ZDIR`
# echo "z: $Z, zdir: $ZDIR"
# for XDIR in $ZDIR/* ; do
# X=`basename $XDIR`
# echo "x: $X, xdir: $XDIR"
# OUTDIR=$TILE_DIR/composite2/$Z/$X
# mkdir -pv $OUTDIR
# FILES=`basename --multiple \`ls $XDIR/*\``
# parallel $PARALLEL_ARGS \
# convert -size 256x256 xc:\\#eeddcc \
# xc:\\#709966 \\\( $TILE_DIR/canopy_mask/$Z/$X/{1} -gamma 0.5 \\\) -composite \
# $OUTDIR/{1} \
# ::: $FILES
# done
# break
# done
for ZDIR in $TILE_DIR/contours_mask/* ; do
Z=`basename $ZDIR`
echo "z: $Z, zdir: $ZDIR"
for XDIR in $ZDIR/* ; do
X=`basename $XDIR`
echo "x: $X, xdir: $XDIR"
OUTDIR=$TILE_DIR/composite2/$Z/$X
mkdir -pv $OUTDIR
FILES=`basename --multiple \`ls $XDIR/*\``
parallel $PARALLEL_ARGS \
convert -size 256x256 xc:\\#eeddcc \
xc:\\#709966 \\\( $TILE_DIR/canopy_mask/$Z/$X/{1} -gamma 0.5 \\\) -composite \
\\\( $TILE_DIR/hillshade/$Z/$X/{1} -level-colors \\#404010,\\#dfdfff -alpha set -channel A -evaluate set 20% \\\) -compose hard-light -composite \
\\\( xc:\\#553300 $TILE_DIR/contours_mask/$Z/$X/{1} -alpha off -compose CopyOpacity -composite \\\) -compose src-over -composite \
$TILE_DIR/features/$Z/$X/{1} -compose src-over -composite \
$OUTDIR/{1} \
::: $FILES
done
done
# # Create JPEG composites
# if $COMPOSITE_JPEG ; then
# echo "Creating JPEG composites..."
# find $TILE_DIR/composite -name "*.png" | \
# parallel echo '{}' \; convert '{}' TGA:- \| \
# $CJPEG -sample 1x1 -quality $JPEG_QUALITY -targa \
# -outfile \`dirname '{}'\`/\`basename '{}' .png\`.jpg
# fi
# Optimize PNG tiles (add other layers as needed)
if $OPTIMIZE_PNG ; then
for LAYER in composite2 ; do
echo "Optimizing PNG in $LAYER..."
find $TILE_DIR/$LAYER -name "*.png" | \
parallel -m $PARALLEL_ARGS pngquant -s 3 -f --ext .png --strip 256
done
fi