|
|
fa0c75 |
#!/bin/bash
|
|
|
fa0c75 |
#
|
|
|
fa0c75 |
# render_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 |
|
|
|
fa0c75 |
function render_convertPngToThumbnail {
|
|
|
fa0c75 |
|
|
|
fa0c75 |
# Get image size.
|
|
|
fa0c75 |
local SIZES=$(render_getConfigOption "$ACTION" '2-')
|
|
|
fa0c75 |
|
|
|
fa0c75 |
# Check base file existence.
|
|
|
fa0c75 |
cli_checkFiles "${FILE}.png" 'f'
|
|
|
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
|
|
|
fa0c75 |
cli_printMessage "${FILE}-thumb-${SIZE}.png" "AsSavedAsLine"
|
|
|
fa0c75 |
convert -resize ${SIZE} ${FILE}.png ${FILE}-thumb-${SIZE}.png
|
|
|
fa0c75 |
cli_printMessage "${FILE}-thumb-${SIZE}.jpg" "AsSavedAsLine"
|
|
|
fa0c75 |
convert -resize ${SIZE} ${FILE}-thumb-${SIZE}.png ${FILE}-thumb-${SIZE}.jpg
|
|
|
fa0c75 |
cli_printMessage "${FILE}-thumb-${SIZE}.pdf" "AsSavedAsLine"
|
|
|
fa0c75 |
convert -resize ${SIZE} ${FILE}-thumb-${SIZE}.png ${FILE}-thumb-${SIZE}.pdf
|
|
|
fa0c75 |
done
|
|
|
fa0c75 |
|
|
|
fa0c75 |
}
|