Excluded *.svg, *.pdf and extensionless files from low-res photos

in the special thesis submodule.
There is no need to convert pdf, svg to jpeg and shrink even in
thesis draft mode.
master
Taha Ahmed 5 years ago
parent 696c5a2127
commit 0ee110ac18

@ -150,6 +150,13 @@ if [ $# -eq 1 ]; then
largephototype=${largephotobase#*.} # file extension only
largephotoname=${largephotofilename%.*} # path without extension
largephotobasename=${largephotobase%.*} # basename without extension
# some filetypes don't fare well when converted to jpeg, so we will only run the
# forced conversion and shrinking unless the file extension is one of the following:
# "" (empty string, ie no file extension)
# SVG
# PDF
if [ ! "$largephototype" == "" ] || [ ! "$largephototype" == "svg" ] || [ ! "$largephototype" == "SVG" ] || [ ! "$largephototype" == "pdf" ] || [ ! "$largephototype" == "PDF" ]; then
# if the photo is not already jpeg, convert it to jpeg
if [ ! "$largephototype" == "jpg" ] && [ ! "$largephototype" == "jpeg" ] && [ ! "$largephototype" == "JPG" ] && [ ! "$largephototype" == "JPEG" ]; then
echo "<thesis> Converting $largephotobase to JPG format"
mogrify -format jpg $largephotofilename
@ -160,6 +167,7 @@ if [ $# -eq 1 ]; then
# https://stackoverflow.com/questions/6917219/imagemagick-scale-jpeg-image-with-a-maximum-file-size
echo "<thesis> Shrinking $largephotobasename.jpg"
convert $largephotoname.jpg -define jpeg:extent=300kb $largephotoname.jpg
fi
done
# update the modification and access time on the photosastrun file
touch "$photoslastrun"

Loading…
Cancel
Save