From 9952a1a7aaa0eb9254668d70b69d845f5f2fd984 Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Thu, 27 Feb 2014 19:51:22 -0800 Subject: [PATCH] Zoom by switching to smaller preprocessed images Loading the full size images with max-height was too slow. Move the previous zoom behaviour from 'z' to 'Z'. --- pics-preprocess | 4 +++- picsorter.js | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/pics-preprocess b/pics-preprocess index d540060..87eca8c 100755 --- a/pics-preprocess +++ b/pics-preprocess @@ -6,11 +6,12 @@ GREEN=1.105 TEMPERATURE=5500 JPEGCOMPRESSION=95 +SMALLHEIGHT=700 for f;do for level in {10..30};do - mkdir -p "$level" + mkdir -p {,sm/}"$level" base="$(basename "$f")" out="$level/${base%.NEF}.jpeg" exposure=$(dc <<< "2k $level 4 / 3.5-p") # 10 to 30 -> -1 to 4 in .25 steps @@ -21,5 +22,6 @@ for f;do --exposure="$exposure" \ --output="$out" \ "$f" + convert "$out" -geometry "x$SMALLHEIGHT" "sm/$out" done done diff --git a/picsorter.js b/picsorter.js index 10d83c9..a12b7e6 100644 --- a/picsorter.js +++ b/picsorter.js @@ -1,15 +1,25 @@ var exposure = 20; var input_index = 0; +var zoom = "sm/"; function setpic() { - $("#pic").attr("src", exposure + "/" + files[input_index]); + $("#pic").attr("src", zoom + exposure + "/" + files[input_index]); +} + +function toggle_zoom() { + if (zoom) { + zoom = ""; + } else { + zoom = "sm/"; + } } $(function() { setpic(); }); -Mousetrap.bind('z', function() { $("#pic").toggleClass("fit_view"); }); +Mousetrap.bind('z', function() { toggle_zoom(); setpic(); }); +Mousetrap.bind('Z', function() { $("#pic").toggleClass("fit_view"); }); Mousetrap.bind('n', function() { input_index ++; setpic(); }); Mousetrap.bind('p', function() { input_index --; setpic(); }); Mousetrap.bind('b', function() { exposure ++; setpic(); }); -- 2.44.1