aboutsummaryrefslogtreecommitdiff
path: root/convert/imgconv
blob: 3ac8bc589b3c48346ef5aab011450562854ca8d1 (plain)
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
#!/bin/bash

#sem dodelat err

adresar=$@

mkdir ./web-gallery
mkdir ./web-gallery/thumbs
mkdir ./web-gallery/lq
mkdir ./web-gallery/mq
mkdir ./web-gallery/hq
mkdir ./web-gallery/zip #used for image tarballs
mkdir ./web-gallery/comments

i=1
for soubor in $adresar
  do 
     echo "konvertuji $soubor"
# IMAGEMAGICK
     #convert -geometry 160x120 -colors 16 -dither $soubor ./web-gallery/thumbs/img-$i.png
     convert -geometry 120x120  $soubor ./web-gallery/thumbs/img-$i.jpg
     convert -geometry 640x480  $soubor ./web-gallery/lq/img-$i.jpg
     convert -geometry 800x600  $soubor ./web-gallery/mq/img-$i.jpg

# NETPBM
     #jpegtopnm $soubor > temp.pnm
     ##cat temp.pnm | pnmscale -xysize 120 120 | ppmquant -floyd 16 | pnmtopng -interlace -compression 9 > ./web-gallery/thumbs/img-$i.png
     #cat temp.pnm | pnmscale -xysize 120 120 | ppmtojpeg --quality 80 --progressive > ./web-gallery/thumbs/img-$i.jpg
     #cat temp.pnm | pnmscale -xysize 640 640 | ppmtojpeg --quality 80 --progressive > ./web-gallery/lq/img-$i.jpg
     #cat temp.pnm | pnmscale -xysize 800 800 | ppmtojpeg --quality 80 --progressive > ./web-gallery/mq/img-$i.jpg
     #rm temp.pnm

     cp $soubor ./web-gallery/hq/img-$i.jpg
     # template for comment
     echo "<span>image $i</span>
" > ./web-gallery/comments/$i.txt
     i=`expr $i + 1`
done

#####################
# Tar-up/zip images #
#####################

#tar cvjf web-gallery/zip/mq.tar.bz2 mq/*.jpg
#tar cvjf web-gallery/zip/hq.tar.bz2 hq/*.jpg
zip -R web-gallery/zip/mq.zip  web-gallery/mq/*.jpg
zip -R web-gallery/zip/hq.zip web-gallery/hq/*.jpg