| 1 |
#How to generate new scale bar thumbnail |
| 2 |
#======================================= |
| 3 |
#Expects North Carolina dataset. The thumbnail height should be 24 px. |
| 4 |
# |
| 5 |
|
| 6 |
export GRASS_RENDER_IMMEDIATE=png |
| 7 |
export GRASS_RENDER_TRUECOLOR=TRUE |
| 8 |
export GRASS_RENDER_WIDTH=300 |
| 9 |
export GRASS_RENDER_HEIGHT=300 |
| 10 |
g.region raster=elevation |
| 11 |
|
| 12 |
#PREFIX=n_arrow_ |
| 13 |
PREFIX="" |
| 14 |
|
| 15 |
for STYLE in 1a 1b 2 3 4 5 6 7a 7b 8a 8b 9 fancy_compass basic_compass arrow1 arrow2 arrow3 star |
| 16 |
do |
| 17 |
echo ${STYLE} |
| 18 |
export GRASS_RENDER_FILE=${PREFIX}${STYLE}.png |
| 19 |
d.northarrow -t style=${STYLE} at=20,20 |
| 20 |
mogrify -trim ${PREFIX}${STYLE}.png |
| 21 |
identify -format "%[fx:w]x%[fx:h]" ${PREFIX}${STYLE}.png |
| 22 |
# first resize it to max size and then place it into a bigger rectangle |
| 23 |
mogrify -resize 24x24 -background white -gravity Center -extent 24x24 ${PREFIX}${STYLE}.png |
| 24 |
optipng -o5 ${PREFIX}${STYLE}.png ${PREFIX}${STYLE}.png --quiet |
| 25 |
done |