Blame Scripts/Functions/Render/render_rotatePngTo.sh

67ae40
#!/bin/bash
67ae40
#
67ae40
# render_rotatePngTo.sh -- This function provides post-rendition
67ae40
# to convert images produced by centos-art base-rendition.
67ae40
#
67ae40
# Copyright (C) 2009-2011 Alain Reguera Delgado
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
#
dcd347
# This program is distributed in the hope that it will be useful,
dcd347
# but WITHOUT ANY WARRANTY; without even the implied warranty of
67ae40
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
67ae40
# General Public License for more details.
67ae40
#
67ae40
# You should have received a copy of the GNU General Public License
67ae40
# along with this program; if not, write to the Free Software
dcd347
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
67ae40
# ----------------------------------------------------------------------
67ae40
# $Id$
67ae40
# ----------------------------------------------------------------------
67ae40
67ae40
function render_rotatePngTo {
67ae40
67ae40
    local COUNT=1
67ae40
    local DEGREE=''
67ae40
    local DEGREES=$(render_getConfigOption "$ACTION" '2-')
67ae40
    local SRC=''
67ae40
    local DST=''
67ae40
67ae40
    # Check base file existence.
67ae40
    cli_checkFiles ${FILE}.png 'f'
67ae40
67ae40
    # Check image degrees.
67ae40
    if [[ "$DEGREES" != "" ]];then
67ae40
67ae40
        # Loop through image degrees and convert them using PNG file
67ae40
        # as base.
67ae40
        for DEGREE in $DEGREES;do
67ae40
            SRC=${FILE}.png
67ae40
            DST=${FILE}-rotated-$(echo $DEGREE | sed 's!%!!').png
67ae40
            cli_printMessage "$DST" "AsSavedAsLine"
67ae40
            convert -rotate $DEGREE ${SRC} ${DST}
67ae40
        done
67ae40
67ae40
    fi
67ae40
67ae40
}