minor tweaks...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-06-28 00:23:04 +04:00
parent f590f4f54f
commit d0d07c852e

View File

@ -21,9 +21,6 @@ exiftool -if '$jpgfromraw' -b -jpgfromraw -w "$PREVIEW_NAME" \
-common_args --ext jpg -r "$ARCHIVE_ROOT" -progress
# need to calculate this correctly...
FACTOR=4.76
SIZE=900
ALGORITHM=bicubic
@ -32,7 +29,6 @@ COMPRESSION=90
PATH=$PATH:`pwd`/vips-dev-7.32.0/bin/
# XXX use find...
for f in "${ARCHIVE_ROOT}"/DCIM/hi-res\ \(RAW\)/*jpg ; do
# create preview dir if it does not already exist...
@ -41,20 +37,22 @@ for f in "${ARCHIVE_ROOT}"/DCIM/hi-res\ \(RAW\)/*jpg ; do
mkdir -p "$D"
fi
# calculate the factor...
W=$(vips im_header_string width "$f")
H=$(vips im_header_string height "$f")
# create previews...
if ! [ -e "${f/hi-res\ /preview }" ] ; then
# NOTE: vips appends \r to these!!!
# get source size...
W=$(vips im_header_int width "$f")
H=$(vips im_header_int height "$f")
# NOTE: vips appends nasty unprintable \r's to values, so we need to clean them out...
W=${W//[![:digit:]]/}
H=${H//[![:digit:]]/}
# calculate the factor...
FACTOR=$(echo "scale = 4; if($H > $W) s = $H else s = $W ; s / $SIZE" | bc -l)
echo "($FACTOR): ${f/hi-res\ /preview }:${COMPRESSION}"
# create previews...
if ! [ -e "${f/hi-res\ /preview }" ] ; then
vips im_shrink "$f" "${f/hi-res\ /preview }:${COMPRESSION}" $FACTOR $FACTOR 2> /dev/null
fi
done