|
|
4c79b5 |
#!/bin/bash
|
|
|
4c79b5 |
#
|
|
|
fe6777 |
# svg_convertPngToBrands.sh -- This function provides post-rendition
|
|
|
fe6777 |
# actions to produce brand images in different sizes and formats from
|
|
|
fe6777 |
# the same SVG design model.
|
|
|
4c79b5 |
#
|
|
|
3b0984 |
# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG
|
|
|
fa95b1 |
#
|
|
|
fa95b1 |
# This program is free software; you can redistribute it and/or modify
|
|
|
fa95b1 |
# it under the terms of the GNU General Public License as published by
|
|
|
dcd347 |
# the Free Software Foundation; either version 2 of the License, or (at
|
|
|
dcd347 |
# your option) any later version.
|
|
|
fa95b1 |
#
|
|
|
74a058 |
# This program is distributed in the hope that it will be useful, but
|
|
|
74a058 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
4c79b5 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
4c79b5 |
# General Public License for more details.
|
|
|
4c79b5 |
#
|
|
|
4c79b5 |
# You should have received a copy of the GNU General Public License
|
|
|
4c79b5 |
# along with this program; if not, write to the Free Software
|
|
|
dcd347 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
7ac5a5 |
#
|
|
|
4c79b5 |
# ----------------------------------------------------------------------
|
|
|
418249 |
# $Id$
|
|
|
4c79b5 |
# ----------------------------------------------------------------------
|
|
|
4c79b5 |
|
|
|
fe6777 |
function svg_convertPngToBrands {
|
|
|
4c79b5 |
|
|
|
f1cb29 |
# Define height dimensions you want to produce brands for.
|
|
|
c3637a |
local SIZE=""
|
|
|
f1cb29 |
local SIZES="16 20 22 24 32 36 40 48 64 96 128 148 164 196 200 512"
|
|
|
4c79b5 |
|
|
|
f1cb29 |
# Define image formats you want to produce brands for.
|
|
|
c3637a |
local FORMAT=""
|
|
|
aa0c83 |
local FORMATS="xpm pdf jpg tif"
|
|
|
4c79b5 |
|
|
|
f1cb29 |
for SIZE in ${SIZES};do
|
|
|
f1cb29 |
|
|
|
aa0c83 |
# Redefine absolute path to file location where size-specific
|
|
|
aa0c83 |
# images will be stored in.
|
|
|
aa0c83 |
local FINALFILE=$(dirname $FILE)/${SIZE}/$(basename $FILE)
|
|
|
aa0c83 |
|
|
|
aa0c83 |
# Prepare directory where size-specific images will be stored
|
|
|
aa0c83 |
# in. If it doesn't exist create it.
|
|
|
aa0c83 |
if [[ ! -d $(dirname $FINALFILE) ]];then
|
|
|
aa0c83 |
mkdir -p $(dirname $FINALFILE)
|
|
|
aa0c83 |
fi
|
|
|
aa0c83 |
|
|
|
aa0c83 |
# Print action message.
|
|
|
aa0c83 |
cli_printMessage "${FINALFILE}.png" --as-creating-line
|
|
|
aa0c83 |
|
|
|
aa0c83 |
# Create size-specific PNG image ommiting all output.
|
|
|
aa0c83 |
inkscape $INSTANCE --export-id=$EXPORTID \
|
|
|
aa0c83 |
--export-png=${FINALFILE}.png --export-height=${SIZE} \
|
|
|
aa0c83 |
&> /dev/null
|
|
|
aa0c83 |
|
|
|
f1cb29 |
for FORMAT in ${FORMATS};do
|
|
|
f1cb29 |
|
|
|
aa0c83 |
# Print action message.
|
|
|
aa0c83 |
cli_printMessage "${FINALFILE}.${FORMAT}" --as-creating-line
|
|
|
f1cb29 |
|
|
|
aa0c83 |
# Convert size-specific PNG image into different formats.
|
|
|
aa0c83 |
convert ${FINALFILE}.png ${FINALFILE}.${FORMAT}
|
|
|
f1cb29 |
|
|
|
f1cb29 |
done
|
|
|
f1cb29 |
|
|
|
aa0c83 |
# Create copy of size-specific image in 2 colors.
|
|
|
aa0c83 |
cli_printMessage "${FINALFILE}.xbm" --as-creating-line
|
|
|
aa0c83 |
convert -colorspace gray -colors 2 ${FINALFILE}.png ${FINALFILE}.xbm
|
|
|
f1cb29 |
|
|
|
aa0c83 |
# Create copy of size-specific image with emboss effect.
|
|
|
aa0c83 |
cli_printMessage "${FINALFILE}-emboss.png" --as-creating-line
|
|
|
aa0c83 |
convert -emboss 1 ${FINALFILE}.png ${FINALFILE}-emboss.png
|
|
|
f1cb29 |
|
|
|
f1cb29 |
done
|
|
|
f1cb29 |
|
|
|
4c79b5 |
}
|