Blame Scripts/Functions/Render/Svg/svg_convertPngToIcons.sh

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