mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 10:20:08 +00:00
now working and tested...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
d0d07c852e
commit
84434e8eb6
@ -9,7 +9,10 @@ RAW_PREVIEW_DIR="hi-res (RAW)"
|
|||||||
PREVIEW_NAME="%-:1d/${RAW_PREVIEW_DIR}/%f.jpg"
|
PREVIEW_NAME="%-:1d/${RAW_PREVIEW_DIR}/%f.jpg"
|
||||||
JSON_NAME="%-:1d/${METADATA_DIR}/%f.json"
|
JSON_NAME="%-:1d/${METADATA_DIR}/%f.json"
|
||||||
|
|
||||||
# XXX need to also copy jpg originals to the preview dir...
|
|
||||||
|
|
||||||
|
# XXX need to also copy jpg originals to the preview dir (things that
|
||||||
|
# were shot in jpeg in-camera)...
|
||||||
# XXX do we need to rotate the images using exif data here???
|
# XXX do we need to rotate the images using exif data here???
|
||||||
# XXX need to prevent overwriting of unchanged exif data...
|
# XXX need to prevent overwriting of unchanged exif data...
|
||||||
# when file exists??
|
# when file exists??
|
||||||
@ -23,26 +26,29 @@ exiftool -if '$jpgfromraw' -b -jpgfromraw -w "$PREVIEW_NAME" \
|
|||||||
|
|
||||||
SIZE=900
|
SIZE=900
|
||||||
|
|
||||||
ALGORITHM=bicubic
|
|
||||||
|
|
||||||
COMPRESSION=90
|
COMPRESSION=90
|
||||||
|
|
||||||
PATH=$PATH:`pwd`/vips-dev-7.32.0/bin/
|
PATH=$PATH:`pwd`/vips-dev-7.32.0/bin/
|
||||||
|
|
||||||
# XXX use find...
|
# makepreview SIZE IN OUT
|
||||||
for f in "${ARCHIVE_ROOT}"/DCIM/hi-res\ \(RAW\)/*jpg ; do
|
makepreview(){
|
||||||
|
|
||||||
|
SIZE="$1"
|
||||||
|
IN="$2"
|
||||||
|
OUT="$3"
|
||||||
|
|
||||||
# create preview dir if it does not already exist...
|
# create preview dir if it does not already exist...
|
||||||
D="`dirname \"${f/hi-res\ /preview }\"`"
|
DIR="`dirname \"${OUT}\"`"
|
||||||
if ! [ -e "$D" ] ; then
|
if ! [ -e "$DIR" ] ; then
|
||||||
mkdir -p "$D"
|
mkdir -p "$DIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# create previews...
|
# create previews...
|
||||||
if ! [ -e "${f/hi-res\ /preview }" ] ; then
|
if ! [ -e "${OUT}" ] ; then
|
||||||
|
|
||||||
# get source size...
|
# get source size...
|
||||||
W=$(vips im_header_int width "$f")
|
W=$(vips im_header_int width "$IN")
|
||||||
H=$(vips im_header_int height "$f")
|
H=$(vips im_header_int height "$IN")
|
||||||
|
|
||||||
# NOTE: vips appends nasty unprintable \r's to values, so we need to clean them out...
|
# NOTE: vips appends nasty unprintable \r's to values, so we need to clean them out...
|
||||||
W=${W//[![:digit:]]/}
|
W=${W//[![:digit:]]/}
|
||||||
@ -51,9 +57,18 @@ for f in "${ARCHIVE_ROOT}"/DCIM/hi-res\ \(RAW\)/*jpg ; do
|
|||||||
# calculate the factor...
|
# calculate the factor...
|
||||||
FACTOR=$(echo "scale = 4; if($H > $W) s = $H else s = $W ; s / $SIZE" | bc -l)
|
FACTOR=$(echo "scale = 4; if($H > $W) s = $H else s = $W ; s / $SIZE" | bc -l)
|
||||||
|
|
||||||
echo "($FACTOR): ${f/hi-res\ /preview }:${COMPRESSION}"
|
echo "($FACTOR): ${OUT}:${COMPRESSION}"
|
||||||
|
|
||||||
vips im_shrink "$f" "${f/hi-res\ /preview }:${COMPRESSION}" $FACTOR $FACTOR 2> /dev/null
|
vips im_shrink "$IN" "${OUT}:${COMPRESSION}" $FACTOR $FACTOR 2> /dev/null
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# XXX use find...
|
||||||
|
for FROM in "${ARCHIVE_ROOT}"/DCIM/hi-res\ \(RAW\)/*jpg ; do
|
||||||
|
TO="${FROM/hi-res\ /preview }"
|
||||||
|
|
||||||
|
# XXX do different-sized previews...
|
||||||
|
makepreview "$SIZE" "$FROM" "$TO"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user