aboutsummaryrefslogtreecommitdiff
path: root/convert/contrib/web-gallery
diff options
context:
space:
mode:
Diffstat (limited to 'convert/contrib/web-gallery')
-rw-r--r--convert/contrib/web-gallery105
1 files changed, 105 insertions, 0 deletions
diff --git a/convert/contrib/web-gallery b/convert/contrib/web-gallery
new file mode 100644
index 0000000..952f8fe
--- /dev/null
+++ b/convert/contrib/web-gallery
@@ -0,0 +1,105 @@
+#!/bin/bash
+
+# Nautilus script to generate image galleries for use with original
+# uses Gnome's zenity for user dialogs
+# uses ImageMagick's convert
+# (c) 2005 boris de laage <bdelaage@free.fr>
+# based on imgconv bu Jakub Steiner
+
+set -e
+
+name=`basename $0`
+
+# convert options
+convertor=`which convert`
+extra_ops="-strip"
+
+#default options
+dir=./web-gallery
+
+files=$(echo $@ | sed 's/ /\n/g' | sort)
+numfiles=$#
+
+if [ -z $convertor ]; then
+ zenity --title $name --error --error-text "convert not found !"
+ exit 1
+fi
+
+if [ $numfiles == 0 ]; then
+ zenity --title $name --error --error-text "No input files !"
+ exit 1
+fi
+
+#progressbar stuff
+steps=5
+increment=`expr 100 / \( $numfiles \* $steps \) `
+progress=0
+
+
+mkdir -p $dir/thumbs
+mkdir -p $dir/lq
+mkdir -p $dir/mq
+mkdir -p $dir/hq
+mkdir -p $dir/zip
+mkdir -p $dir/comments
+chmod o+w $dir/comments
+
+echo "<Files info.txt>" > $dir/.htaccess
+echo " deny from all" >> $dir/.htaccess
+echo "</Files>" >> $dir/.htaccess
+
+
+i=1
+
+for imagefile in $files
+ do
+ process="converting $imagefile"
+
+ # Thumbnail
+ echo "#$process : thumbnail"
+ $convertor -geometry 120x120 -modulate 100,140,100 -unsharp 1x20 \
+ -quality 60 $extra_opts $imagefile $dir/thumbs/img-$i.jpg
+ progress=`expr $progress + $increment`
+ echo $progress
+
+ # LQ
+ echo "#$process : lq"
+ $convertor -geometry 640x480 -modulate 100,130,100 -unsharp 1x5 \
+ -quality 90 $imagefile $dir/lq/img-$i.jpg
+ progress=`expr $progress + $increment`
+ echo $progress
+
+ # MQ
+ echo "#$process : mq"
+ $convertor -geometry 1024x768 -modulate 100,130,100 -unsharp 1x5 \
+ -quality 80 $imagefile $dir/mq/img-$i.jpg
+ progress=`expr $progress + $increment`
+ echo $progress
+
+ # HQ
+ echo "#$process : hq"
+ cp $imagefile $dir/hq/img-$i.jpg
+ progress=`expr $progress + $increment`
+ echo $progress
+
+ # Comments
+ echo "#$process : comments"
+ # template for comment
+ echo "<span>Photo $i</span> " > $dir/comments/$i.txt
+ progress=`expr $progress + $increment`
+ echo $progress
+
+ i=`expr $i + 1`
+
+done | zenity --progress --title="Scaling images, please wait..." --auto-close
+
+
+(
+ echo "1"
+ echo "#Making archives"
+ zip -R $dir/zip/mq.zip web-gallery/mq/*.jpg
+ zip -R $dir/zip/hq.zip web-gallery/hq/*.jpg
+ echo "100"
+) | zenity --progress --pulsate --auto-close --title="Zipping images"
+
+zenity --title $name --info --info-text "Your <b>O.R.I.G.I.N.A.L</b> gallery is ready."