#!/bin/bash
# This file is part of the PyOWS-WMS-Server package (= program).
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
#
# author(s): Sebastian Holler
#
# Copyright (c)2008 by Sebastian Holler
# for document references, used in this source code: see
# use: convert text into an image
# run this script in shell environment!!
# input (via stdin): width#height#format[png|gif|jpg]#\n
# text
# output: image with defined format
CONV_TXT_FILE=${SHELL_TMPDIR}_inimage.text
cat /dev/stdin > ${CONV_TXT_FILE}
ORIG_IFS=$IFS
IFS="#"
read CONV_WIDTH CONV_HEIGHT CONV_FORMAT < "text in images" options, see: http://www.imagemagick.org/Usage/text/
sed -n '2,$ p' ${CONV_TXT_FILE} | \
convert -background "#FFFFFF" -fill black -size ${CONV_WIDTH}x${CONV_HEIGHT} \
-pointsize 10 -gravity Center caption:@- "${CONV_IMG_FILE}"
rm -f "${CONF_TXT_FILE}"
echo -n "${CONV_IMG_FILE}"