-
Notifications
You must be signed in to change notification settings - Fork 0
/
convert_image_force
executable file
·42 lines (36 loc) · 1.05 KB
/
convert_image_force
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
#!/bin/bash
date='*'
basepath=/wasu/video
destpath=/wasu/website/v/video_thumb
cover_img=/home/daijj/publisher/play_cover.png
if [ ! -e $cover_img ]; then
echo "error: $cover_img file don't exist!"
exit 1
fi
if [ ! -e $destpath ]; then
echo "make dir $destpath"
mkdir $destpath
fi
if [ -n "$1" ]; then
echo $1
date=$1
fi
printf "begin convert images "
for file in $basepath/$date/*.jpg ; do
p="${file%/*}"
d="${p##*/}"
f="${file##*/}"
f="${f%.*}"
dest="$destpath/$d"
if [ ! -e $dest ]; then
mkdir $dest
fi
#if [ ! -e "$dest/$f.jpg" ]; then
printf "."
gm convert -quality 100 -unsharp "0.5x1.0+0.8+0.03" -size 104x77 $file -resize 104x77 +profile "*" "$dest/$f.jpg"
gm convert -quality 100 -unsharp "0.5x1.0+0.8+0.03" -size 300x225 $file -resize 300x225 +profile "*" "$dest/${f}_play.jpg"
gm convert -quality 100 -unsharp "0.5x1.0+0.8+0.03" -size 320x240 $file -resize 320x240! +profile "*" "$dest/${f}_big.jpg"
gm composite -quality 100 $cover_img "$dest/${f}_play.jpg" "$dest/${f}_play.jpg"
#fi
done
printf " done!\n"