From 0d6662d093d8f128370e9e54ccc5b417a1ca4172 Mon Sep 17 00:00:00 2001 From: Aaron Fischer Date: Tue, 2 May 2017 21:53:33 +0200 Subject: [PATCH] Increase the image quality #17 --- src/clj/yenu/helpers/images.clj | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/clj/yenu/helpers/images.clj b/src/clj/yenu/helpers/images.clj index fe7db59..d8e18cd 100644 --- a/src/clj/yenu/helpers/images.clj +++ b/src/clj/yenu/helpers/images.clj @@ -3,6 +3,8 @@ [image-resizer.util :as utils] [image-resizer.format :refer :all] [image-resizer.crop :refer :all] + [image-resizer.resize :refer :all] + [image-resizer.scale-methods :refer :all] [clojure.java.io :as io] [digest :as digest] [me.raynes.fs :as fs] @@ -35,17 +37,17 @@ (defn scale-thumbnail [width] #(let [image-file % [orig-width orig-height] (dimensions (utils/buffered-image image-file))] (if (< orig-width orig-height) - (let [resized-img (resize-to-width image-file width) + (let [resized-img ((resize-width-fn width ultra-quality) image-file) [w h] (dimensions resized-img) crop-margin (quot (- h width) 2)] (crop-from resized-img 0 crop-margin width width)) - (let [resized-img (resize-to-height image-file width) + (let [resized-img ((resize-height-fn width ultra-quality) image-file) [w h] (dimensions resized-img) crop-margin (quot (- w width) 2)] (crop-from resized-img crop-margin 0 width width))))) (defn scale-normal [width height] - #(resize % width height)) + (resize-fn width height ultra-quality)) (defn save [fn params filepath target-filepath] (let [file (exif/without-exif (io/file filepath))]