Blame Scripts/Functions/Render/render_resizePngTo.sh

e5c724
#!/bin/bash
e5c724
#
e5c724
# render_resizePngTo.sh -- This function provides post-rendition to
e5c724
# resize images produced by centos-art base-rendition.
e5c724
#
e5c724
# Copyright (C) 2009-2011 Alain Reguera Delgado
e5c724
# 
e5c724
# This program is free software; you can redistribute it and/or
e5c724
# modify it under the terms of the GNU General Public License as
e5c724
# published by the Free Software Foundation; either version 2 of the
e5c724
# License, or (at your option) any later version.
e5c724
# 
e5c724
# This program is distributed in the hope that it will be useful, but
e5c724
# WITHOUT ANY WARRANTY; without even the implied warranty of
e5c724
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
e5c724
# General Public License for more details.
e5c724
#
e5c724
# You should have received a copy of the GNU General Public License
e5c724
# along with this program; if not, write to the Free Software
e5c724
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
e5c724
# USA.
e5c724
# 
e5c724
# ----------------------------------------------------------------------
e5c724
# $Id$
e5c724
# ----------------------------------------------------------------------
e5c724
e5c724
function render_resizePngTo {
e5c724
e5c724
    local SIZE=''
e5c724
    local SIZES=$(render_getConfigOption "$ACTION" '2-')
e5c724
    local SRC=''
e5c724
    local DST=''
e5c724
e5c724
    # Check base file existence.
e5c724
    cli_checkFiles ${FILE}.png 'f'
e5c724
e5c724
    # Check image degrees.
e5c724
    if [[ "$SIZES" != "" ]];then
e5c724
e5c724
        # Loop through image degrees and convert them using PNG file
e5c724
        # as base.
e5c724
        for SIZE in $SIZES;do
e5c724
            SRC=${FILE}.png
e5c724
            DST=${FILE}-resized-$(echo $SIZE | sed 's!%!!').png
e5c724
            cli_printMessage "$DST" "AsSavedAsLine"
e5c724
            convert -resize $SIZE ${SRC} ${DST}
e5c724
        done
e5c724
e5c724
    fi
e5c724
e5c724
}