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
#
2d3646
# Copyright (C) 2009, 2010, 2011 The CentOS Project
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
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
dcd347
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
7ac5a5
#
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
}