-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathg-image
More file actions
executable file
·98 lines (83 loc) · 2.21 KB
/
Copy pathg-image
File metadata and controls
executable file
·98 lines (83 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/bin/sh
#
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
#
# Written by Giorgio Desideri <giorgio.desideri@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
#
MODE_RUN=0
WORKING_DIR=""
# Check Blanks
if [ -z "$@" ];
then
printf "Usage:\n"
printf "\t --resize - resize image\n"
printf "\t --adjust - adjust/balance image\n"
printf "\t --both - adjust/balance AND resize image\n\n"
exit 0
fi
# Input params
for param in "$@"
do
# Resize command
if [ "$param" = "--resize" ];
then
MODE_RUN=1
continue
fi
# Adjust command
if [ "$param" = "--adjust" ];
then
MODE_RUN=2
continue
fi
# Resize and Adjust command
if [ "$param" = "--both" ];
then
MODE_RUN=3
continue
fi
if [ -z "$param" ];
then
WORKING_DIR=$param
fi
done
# Execute Job
for file in `ls $WORKING_DIR`
do
# Normalize Filename
name=`echo $file | cut -f1 -d.`
# Execute job
case $MODE_RUN in
1)
printf "Resize images\n"
convert -verbose -geometry 1024x768 -quality 95 $file ${name}_resize.jpg
;;
2)
printf "Adjust images\n"
# execute adjust
convert -verbose -auto-level $file ${name}_adjust.jpg
;;
3)
printf "Adjust and Resize images\n"
convert -verbose -auto-level -geometry 1024x768 $file ${name}_adjust.jpg
;;
esac;
done