|
|
fa0c75 |
#!/bin/bash
|
|
|
fa0c75 |
#
|
|
|
806ac4 |
# svg_convertPngToThumbnail.sh -- This function provides post-rendition to
|
|
|
fa0c75 |
# create thumbnails from images produced by centos-art base-rendition.
|
|
|
fa0c75 |
# Thumbnails are created in PNG and JPG format for you to decide which
|
|
|
fa0c75 |
# is the more appropriate one. When no size is specified, thumbnails
|
|
|
fa0c75 |
# are created at 250 pixels width and height is automatically
|
|
|
fa0c75 |
# calculated to match the image ratio.
|
|
|
fa0c75 |
#
|
|
|
2d3646 |
# Copyright (C) 2009, 2010, 2011 The CentOS Project
|
|
|
fa0c75 |
#
|
|
|
fa0c75 |
# This program is free software; you can redistribute it and/or modify
|
|
|
fa0c75 |
# 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.
|
|
|
fa0c75 |
#
|
|
|
74a058 |
# This program is distributed in the hope that it will be useful, but
|
|
|
74a058 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
fa0c75 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
fa0c75 |
# General Public License for more details.
|
|
|
fa0c75 |
#
|
|
|
fa0c75 |
# You should have received a copy of the GNU General Public License
|
|
|
fa0c75 |
# along with this program; if not, write to the Free Software
|
|
|
dcd347 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
7ac5a5 |
#
|
|
|
fa0c75 |
# ----------------------------------------------------------------------
|
|
|
fa0c75 |
# $Id$
|
|
|
fa0c75 |
# ----------------------------------------------------------------------
|
|
|
fa0c75 |
|
|
|
806ac4 |
function svg_convertPngToThumbnail {
|
|
|
fa0c75 |
|
|
|
fa0c75 |
# Get image size.
|
|
|
fa0c75 |
local SIZES=$(render_getConfigOption "$ACTION" '2-')
|
|
|
fa0c75 |
|
|
|
fa0c75 |
# Check base file existence.
|
|
|
9e91ed |
cli_checkFiles "${FILE}.png"
|
|
|
fa0c75 |
|
|
|
fa0c75 |
# Check image sizes and do convertion.
|
|
|
fa0c75 |
if [[ "$SIZES" == "" ]];then
|
|
|
fa0c75 |
SIZES='250'
|
|
|
fa0c75 |
fi
|
|
|
fa0c75 |
|
|
|
fa0c75 |
# Create thumbnails.
|
|
|
fa0c75 |
for SIZE in $SIZES;do
|
|
|
0ff158 |
cli_printMessage "${FILE}-thumb-${SIZE}.png" --as-savedas-line
|
|
|
fa0c75 |
convert -resize ${SIZE} ${FILE}.png ${FILE}-thumb-${SIZE}.png
|
|
|
0ff158 |
cli_printMessage "${FILE}-thumb-${SIZE}.jpg" --as-savedas-line
|
|
|
fa0c75 |
convert -resize ${SIZE} ${FILE}-thumb-${SIZE}.png ${FILE}-thumb-${SIZE}.jpg
|
|
|
0ff158 |
cli_printMessage "${FILE}-thumb-${SIZE}.pdf" --as-savedas-line
|
|
|
fa0c75 |
convert -resize ${SIZE} ${FILE}-thumb-${SIZE}.png ${FILE}-thumb-${SIZE}.pdf
|
|
|
fa0c75 |
done
|
|
|
fa0c75 |
|
|
|
fa0c75 |
}
|