working on workflow support scripts...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-06-26 18:07:07 +04:00
parent da9a753f03
commit 0821b527c4
3 changed files with 60 additions and 10 deletions

View File

@ -1,7 +1,7 @@
#=======================================================================
__version__ = '''0.0.01'''
__sub_version__ = '''20130622165505'''
__sub_version__ = '''20130626175935'''
__copyright__ = '''(c) Alex A. Naanou 2011'''
@ -63,8 +63,8 @@ CONFIG = {
'150px': 150,
'350px': 350,
'900px': 900,
'1080px': 1080,
'1920px': 1920,
## '1080px': 1080,
## '1920px': 1920,
}
}
@ -316,7 +316,8 @@ def build_previews(image, path=None, config=CONFIG, dry_run=True, verbosity=0):
img_path = image['path']
if absolute_path == False:
source_path = os.path.join(path, img_path)
## source_path = os.path.join(path, img_path)
source_path = os.path.join(path, urllib2.url2pathname(img_path))
else:
# XXX is this the best way???
o = urllib2.urlopen(img_path)
@ -348,16 +349,15 @@ def build_previews(image, path=None, config=CONFIG, dry_run=True, verbosity=0):
# add image to index...
if not os.path.exists(p):
# use the preview to speed things up...
# NOTE: this will degrade the quality of previews after
# several resizes...
## if preview != None:
## img = preview
scale = spec/float(max(*img.size))
preview = img.resize((int(img.size[0]*scale), int(img.size[1]*scale)), Image.ANTIALIAS)
if not dry_run:
preview.save(p)
preview.save(p, quality=80)
# use the preview to speed things up...
# NOTE: this will degrade the quality of previews after
# several resizes...
img = Image.open(p, 'r')
else:
preview.close()

9
scripts/extract-metadata.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
# extract hi-res previews...
#exiftool -b -JpgFromRaw -w "%-:1d/hi-res (RAW)/%f.jpg" -ext NEF -r .
# extract metadata in JSON format...
exiftool -j -w "%-:1d/metadata/%f.json" -ext NEF -r . -progress

41
scripts/vips-tn.sh Executable file
View File

@ -0,0 +1,41 @@
#!/bin/bash
SCALE=0.21
FACTOR=4.76
ALGORITHM=bicubic
COMPRESSION=90
PATH=$PATH:`pwd`/vips-dev-7.32.0/bin/
for f in */DCIM/hi-res\ \(RAW\)/*jpg ; do
# this yields images with EXTREAM aliasing artifacts, with all supported algorithms
# NOTE: vips appears not to support lanczos scaling...
##vips im_affinei_all "$f" "${f/hi-res\ /preview }:${COMPRESSION}" $ALGORITHM $SCALE 0 0 $SCALE 0 0
# NOTE: -n (no sharpening) gives a bit too blurry results...
# NOTE: this also renames the files...
##vipsthumbnail -s 900 "$f"
# this gives lots of warnings but appears to be OK... but not too fast.
# so far, this is the best result...
# NOTE: this, being "not too fast" actually is the fastest when comparing to I_View or PIL...
# - I_View ~2-3 minutes
# - PIL ~6 minutes
# - im_shrink <2 minutes
vips im_shrink "$f" "${f/hi-res\ /preview }:${COMPRESSION}" $FACTOR $FACTOR
# this is different in that it uses a shrink factor while opening the image, thus
# a different scale factor...
# - ALLOT faster
# - blurry in comparison
##vips im_shrink "$f:4" "${f/hi-res\ /preview }:${COMPRESSION}" 1.19 1.19
# apply different amounts of read scaling...
# still quite extreme aliasing...
# IDEA: it's so extream, might be a good idea to first blur the image some and then scale...
##vips im_affinei_all "$f:2" "${f/hi-res\ /preview }:${COMPRESSION}" $ALGORITHM 0.42 0 0 0.42 0 0
# artifacts, better than all previous attempts at im_affinei_all, but worse than plain im_shrink...
##vips im_affinei_all "$f:4" "${f/hi-res\ /preview }:${COMPRESSION}" $ALGORITHM 0.84 0 0 0.84 0 0
done