Created
November 22, 2011 06:30
-
-
Save sunng87/1385055 to your computer and use it in GitHub Desktop.
Image scalling with java-image-scaling
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns gen-class-test.imgscale | |
(:use [clojure.java.io]) | |
(:import [javax.imageio ImageIO]) | |
(:import [com.mortennobel.imagescaling ResampleOp ResampleFilters])) | |
(defn read-img [path] | |
(ImageIO/read (file path))) | |
(defn write-img [img path] | |
(ImageIO/write img "jpg" (file path))) | |
(defn scale-image [source resample-op] | |
(.filter resample-op source nil)) | |
(defn -main [& args] | |
(println "resampling...") | |
(write-img (scale-image | |
(read-img "/home/nsun2/downloads/c44.jpg") | |
(doto | |
(ResampleOp. 150 100) | |
(.setFilter (ResampleFilters/getBiCubicFilter)))) | |
"/home/nsun2/tmp/c44-sampled.jpg")) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment