-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprocess_images.sh
executable file
·65 lines (54 loc) · 1.26 KB
/
process_images.sh
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
###
# Script to process (resize, clone) images
#
# Run from insite repo root (artopia)
###
# Resize with max height
resizeMaxHeight()
{
# DEFAULT_MAX_HEIGHT=1024
MAX_HEIGHT=${1:-1024}
echo "resizeMaxHeight(x$MAX_HEIGHT) : start"
for ext in "${imageFileTypeArray[@]}"
do
echo "Processing .$ext files..."
convert "*.$ext[x$MAX_HEIGHT>]" -set filename:base "%[base]" "%[filename:base].$ext"
# or do whatever with individual element of the array
done
echo "resizeMaxHeight: end"
echo "###"
}
# Make thumbnails
makeThumbnails()
{
# DEFAULT_WIDTH=300
WIDTH=${1:-300}
echo "makeThumbnails(x$WIDTH) : start"
for ext in "${imageFileTypeArray[@]}"
do
echo "Processing .$ext files..."
mogrify -path thumbnail/ -resize "$WIDTH"x *.$ext
# or do whatever with individual element of the array
done
echo "makeThumbnails : end"
echo "###"
}
mainFunction()
{
# The image filetypes to process
declare -a imageFileTypeArray=("png" "jpg" "gif")
cd assets/images/categories
# Category - Gallery
echo "Category - Gallery..."
cd gallery
resizeMaxHeight
makeThumbnails
# Category - Gaia Shrine
echo "Category - Gaia Shrine..."
cd ../gaia-shrine
resizeMaxHeight
makeThumbnails
}
# Call mainFunction
mainFunction
###