Increase the image quality #17
This commit is contained in:
parent
5bfb5c1c2f
commit
0d6662d093
1 changed files with 5 additions and 3 deletions
|
@ -3,6 +3,8 @@
|
||||||
[image-resizer.util :as utils]
|
[image-resizer.util :as utils]
|
||||||
[image-resizer.format :refer :all]
|
[image-resizer.format :refer :all]
|
||||||
[image-resizer.crop :refer :all]
|
[image-resizer.crop :refer :all]
|
||||||
|
[image-resizer.resize :refer :all]
|
||||||
|
[image-resizer.scale-methods :refer :all]
|
||||||
[clojure.java.io :as io]
|
[clojure.java.io :as io]
|
||||||
[digest :as digest]
|
[digest :as digest]
|
||||||
[me.raynes.fs :as fs]
|
[me.raynes.fs :as fs]
|
||||||
|
@ -35,17 +37,17 @@
|
||||||
(defn scale-thumbnail [width]
|
(defn scale-thumbnail [width]
|
||||||
#(let [image-file % [orig-width orig-height] (dimensions (utils/buffered-image image-file))]
|
#(let [image-file % [orig-width orig-height] (dimensions (utils/buffered-image image-file))]
|
||||||
(if (< orig-width orig-height)
|
(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)
|
[w h] (dimensions resized-img)
|
||||||
crop-margin (quot (- h width) 2)]
|
crop-margin (quot (- h width) 2)]
|
||||||
(crop-from resized-img 0 crop-margin width width))
|
(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)
|
[w h] (dimensions resized-img)
|
||||||
crop-margin (quot (- w width) 2)]
|
crop-margin (quot (- w width) 2)]
|
||||||
(crop-from resized-img crop-margin 0 width width)))))
|
(crop-from resized-img crop-margin 0 width width)))))
|
||||||
|
|
||||||
(defn scale-normal [width height]
|
(defn scale-normal [width height]
|
||||||
#(resize % width height))
|
(resize-fn width height ultra-quality))
|
||||||
|
|
||||||
(defn save [fn params filepath target-filepath]
|
(defn save [fn params filepath target-filepath]
|
||||||
(let [file (exif/without-exif (io/file filepath))]
|
(let [file (exif/without-exif (io/file filepath))]
|
||||||
|
|
Loading…
Reference in a new issue