Gallery Optimized for Viewing Books and Documents (to then bookmark).
It is easier to carry around a micro sd card than 10kg of books.
So you might at some stage have photographed with your camera some documents or book pages.
When you eventually look at the photographed pages on your computer screen you are less than impressed.
The photos are darker than you thought they were.
They are going to need contrast and brightness increasing, before they are good enough to stitch together into a gallery.
This script
gallery5.sh is basically the same as the previous gallery scripts, but with a few extra features added.
1. An option at the start of batch thumbnailing to brighten up all the photos.
2. The photo thumbnail widths are 1200 pixels, double the resolution of before.
Dazzle or Normal is a one off choice to be made at the beginning of thumbnailing.
Dazzle implements imagemagick's "brightness, contrast, hue" feature.
I set it to -modulate 160,160,100 which is in my opinion, with my photos, fairly good.
Written text needs to be sharp and focussed . . . not compressed too much and blurry, so that is why the resolution has been increased.
It also means bigger image files and therefore slower loading.
Code: Select all
#! /bin/sh
# put this script in the folder with the images.
# define EXIT and cancel
end_it_all(){
echo "<select id=\"nav\" onchange=\"location=this.value\">" >> index.html
cat temp.txt >> index.html
echo "</select>" >> index.html
echo "</body>" >> index.html
echo "</html>" >> index.html
}
rm -rf temp.txt
title=$(pwd | awk -F / '{print $NF}')
title=$(echo $title | yad --mouse --width=1000 --title="Edit Title or add one here" --text-info --editable)
ret=$?
if [[ $ret -eq 1 ]];then exit 0;fi
if [[ $title = "" ]]; then title=$(echo "no title"); fi
echo "<!DOCTYPE html>" > index.html
echo "<head>" >> index.html
echo "<title>$title</title>" >> index.html
echo "<link rel=\"shortcut icon\" href=\"/root/.bookmarks/bm/img/favicon.ico\">" >> index.html
echo "<style>" >> index.html
echo "body{background-color:#ba8;background-image:url('/root/.bookmarks/bm/img/bg.jpg')}" >> index.html
echo "img{border:solid 4px white;margin:0px 0px;position:relative;top:4px;width:100%}" >> index.html
echo "#nav{position:fixed;top:4px;right:4px;border:solid 2px yellow}" >> index.html
echo "</style>" >> index.html
echo "<script type=\"text/javascript\">function nav(){location=loc;document.getElementById('nav').value=loc}</script>" >> index.html
echo "</head>" >> index.html
echo "<body onload=\"document.getElementById('nav').value=window.location.hash\">" >> index.html
fext=$(echo ".JPG" | yad --mouse --width=800 --title="VERY IMPORTANT file extension of the images" --text-info --editable)
ret=$?
if [[ $ret -eq 1 ]];then exit 0;fi
if [[ $fext = "" ]]; then fext=$(echo ".JPG"); fi
yad --mouse --title="Dazzle?" --button="Dazzle:0" --button="Normal:2"
ret=$?
if [[ $ret -eq 0 ]];then
daz=$(echo "-modulate 160,160,100");echo $daz;fi
if [[ $ret -eq 2 ]];then
daz=$(echo "");echo $daz;fi
for i in *$fext; do
convert.im6 -resize 1200x $daz "$i" "tn_"$i
# remove file extension
im=$(basename "$i")
id="${im%.*}"
yad --image="tn_$i" --mouse --title="ROTATE?" \
--button="EXIT:6" \
--button="270:2" \
--button="180:3" \
--button="90:4" \
--button="0:5"
ret=$?
if [[ $ret -eq 2 ]]; then
convert.im6 -rotate 270 -resize 1200x $daz "$i" "tn_"$i
desc=$(echo "tn_"$i | yad --image="tn_$i" --mouse --width=1600 --title="Edit Description or add one here" --text-info --editable)
ret=$?
if [[ $ret -eq 1 ]];then
end_it_all
exit 0;fi
if [[ $desc = "" ]]; then desc=$(echo "tn_"$i); fi
echo "<div id=\"$id\"><img src=\"tn_$i\" alt=\"$desc\" title=\"$desc\" onclick=\"loc='#$id';nav()\"></div>" >> index.html;
echo "<option value=\"#$id\">$desc</option>" >> temp.txt;
fi
if [[ $ret -eq 3 ]]; then
convert.im6 -rotate 180 -resize 1200x $daz "$i" "tn_"$i
desc=$(echo "tn_"$i | yad --image="tn_$i" --mouse --width=1600 --title="Edit Description or add one here" --text-info --editable)
ret=$?
if [[ $ret -eq 1 ]];then
end_it_all
exit 0;fi
if [[ $desc = "" ]]; then desc=$(echo "tn_"$i); fi
echo "<div id=\"$id\"><img src=\"tn_$i\" alt=\"$desc\" title=\"$desc\" onclick=\"loc='#$id';nav()\"></div>" >> index.html;
echo "<option value=\"#$id\">$desc</option>" >> temp.txt;
fi
if [[ $ret -eq 4 ]]; then
convert.im6 -rotate 90 -resize 1200x $daz "$i" "tn_"$i
desc=$(echo "tn_"$i | yad --image="tn_$i" --mouse --width=1600 --title="Edit Description or add one here" --text-info --editable)
ret=$?
if [[ $ret -eq 1 ]];then
end_it_all
exit 0;fi
if [[ $desc = "" ]]; then desc=$(echo "tn_"$i); fi
echo "<div id=\"$id\"><img src=\"tn_$i\" alt=\"$desc\" title=\"$desc\" onclick=\"loc='#$id';nav()\"></div>" >> index.html;
echo "<option value=\"#$id\">$desc</option>" >> temp.txt;
fi
if [[ $ret -eq 5 ]]; then
convert.im6 -resize 1200x $daz "$i" "tn_"$i
desc=$(echo "tn_"$i | yad --image="tn_$i" --mouse --width=1600 --title="Edit Description or add one here" --text-info --editable)
ret=$?
if [[ $ret -eq 1 ]];then
end_it_all
exit 0;fi
if [[ $desc = "" ]]; then desc=$(echo "tn_"$i); fi
echo "<div id=\"$id\"><img src=\"tn_$i\" alt=\"$desc\" title=\"$desc\" onclick=\"loc='#$id';nav()\"></div>" >> index.html;
echo "<option value=\"#$id\">$desc</option>" >> temp.txt;
fi
if [[ $ret -eq 6 ]]; then
end_it_all
exit 0
fi
done;
end_it_all
You might need to tweak the imagemagick parameters and resolutions to suit your particular screen size or maybe the brightness is not exactly what you want.
Modify to suit.