All Projects → josephwilk → Image Resizer

josephwilk / Image Resizer

Resize/Crop/Rotate/Pad images in Clojure without any native install. Oh and do it Fast.

Programming Languages

clojure
4091 projects

Labels

Projects that are alternatives of or similar to Image Resizer

Uppload
📁 JavaScript image uploader and editor, no backend required
Stars: ✭ 1,673 (+1157.89%)
Mutual labels:  image
Winmerge
WinMerge is an Open Source differencing and merging tool for Windows. WinMerge can compare both folders and files, presenting differences in a visual text format that is easy to understand and handle.
Stars: ✭ 2,358 (+1672.93%)
Mutual labels:  image
Collage maker
Picture collage maker in Python
Stars: ✭ 131 (-1.5%)
Mutual labels:  image
Releases
dahliaOS ISO releases
Stars: ✭ 125 (-6.02%)
Mutual labels:  image
Lerc
Limited Error Raster Compression
Stars: ✭ 126 (-5.26%)
Mutual labels:  image
Bbwebimage
A high performance Swift library for downloading, caching and editing web images asynchronously.
Stars: ✭ 128 (-3.76%)
Mutual labels:  image
Gil
Boost.GIL - Generic Image Library | Requires C++11 since Boost 1.68
Stars: ✭ 122 (-8.27%)
Mutual labels:  image
Kjemitterview
粒子效果、扩展、好用的工具等等,Button图文混排、点击事件封装、扩大点击域、点赞粒子效果,手势封装、圆角渐变、倒影、内阴影处理、Xib属性、识别网址超链接,图片加工处理、对花铺贴效果、滤镜渲染、泛洪算法,_KJMacros常用宏定义,Label富文本,自定义动画选中控件,Alert控件,数组和字典防崩处理,数组算法处理等等等
Stars: ✭ 133 (+0%)
Mutual labels:  image
Stfalconimageviewer
A simple and customizable Android full-screen image viewer with shared image transition support, "pinch to zoom" and "swipe to dismiss" gestures
Stars: ✭ 1,734 (+1203.76%)
Mutual labels:  image
Imagehash
🌄 Perceptual image hashing for PHP
Stars: ✭ 1,744 (+1211.28%)
Mutual labels:  image
Ucrop
Image Cropping Library for Android
Stars: ✭ 11,003 (+8172.93%)
Mutual labels:  image
React Files
A file input (dropzone) management component for React
Stars: ✭ 126 (-5.26%)
Mutual labels:  image
Weibo image uploader
PHP 实现的微博图床上传轮子
Stars: ✭ 129 (-3.01%)
Mutual labels:  image
Lilliput
Resize images and animated GIFs in Go
Stars: ✭ 1,690 (+1170.68%)
Mutual labels:  image
Fabric Photo
基于canvas的前端图片编辑器
Stars: ✭ 132 (-0.75%)
Mutual labels:  image
Next Optimized Images
🌅 next-optimized-images automatically optimizes images used in next.js projects (jpeg, png, svg, webp and gif).
Stars: ✭ 1,870 (+1306.02%)
Mutual labels:  image
Mergi
go library for image programming (merge, crop, resize, watermark, animate, ease, transit)
Stars: ✭ 127 (-4.51%)
Mutual labels:  image
Romwbw
System Software for Z80/Z180 Computers
Stars: ✭ 133 (+0%)
Mutual labels:  image
Zoomy
Adds seamless scrollView and instagram like zooming to UIImageViews in any view hierarchy.
Stars: ✭ 130 (-2.26%)
Mutual labels:  image
Image Promise
🎑🤞 Load one or more images, return a promise. Tiny, browser-only, no dependencies.
Stars: ✭ 129 (-3.01%)
Mutual labels:  image

Clojure Image Resizer

Build Status

Clojars Project

(Drink to make small)

Make smaller Drink to make small

Why?

  • Very fast (supports hardware accelerated operations on most platforms)
  • No native libraries to install (I'm looking at you imagemagick)

Image Resizer under the hood wraps imgscalr.

Installation

Add the following dependency to your project.clj file:

Clojars Project

Usage

Pipelining Transforms

Image resizer creates tranforms which return fns that apply that transform to an image.

A number of transforms are supported:

  • resize
  • crop
  • pad
  • rotate

If you want to perform a number of operations across an image (such as resize, crop, flip & pad):

(require [image-resizer.crop :refer :all])
(require [image-resizer.resize :refer :all])
(require [image-resizer.pad :refer :all])
(require [image-resizer.rotate :refer :all])

(-> image
    ((resize-fn 100 100))
    ((crop-fn 100 100))
    ((rotate-vertically-fn))
    ((pad-fn 10)))


;Or if you want to apply a transform to a batch of images in parallel:

(doall (clojure.core/pmap (resize-fn 100 100) [image1 image2 image3 image4]))

Tweaking quality/speed ratio

You can tweak your preferences for a resize transform. Favouring speed or quality:

(require [image-resizer.resize :refer :all])
(require [image-resizer.scale-methods :refer :all])

(resize-fn 100 100 ultra-quality) ;best quality
(resize-fn 100 100 speed)         ;fast as possible resize

Lazy helpers around transforms

If creating your own pipelines seems a bit funky, you can use some nice helpers for commmon operations:

(require [image-resizer.core :refer :all])

;Resize an image while respecting original ratio
;Notice how the height is not 10 to respect the ratio of the image
(resize (file "white-rabbit.jpg") 10 10)          ; => #<BufferedImage width=10 height=4>

;Resize an image to a width
(resize-to-width (file "queen-of-hearts.jpg") 10) ; => #<BufferedImage width=10 height=4>

;Resize an image to a height
(resize-to-height (file "cheshire-cat.jpg") 10)   ; => #<BufferedImage width=5 height=10>

;Force width and a height resize (ignoring ratios)
(force-resize (file "cheshire-cat.jpg") 10 1000)   ; => #<BufferedImage width=10 height=1000>

;Crop the image width
(crop-to-width (file "tea-party/mad-hatter.jpg") 10) ; => #<BufferedImage width=10 height=1000>

;Crop the image height
(crop-to-height (file "tea-party/mad-hatter.jpg") 10) ; => #<BufferedImage width=1000 height=10>

;Crop the image width and height
(crop (file "tea-party/mad-hatter.jpg") 10 20) ; => #<BufferedImage width=10 height=20>

;Crop the image width and height from a coord
(crop-from (file "tea-party/mad-hatter.jpg") 6 7 10 20) ; => #<BufferedImage width=10 height=20>

;Resize the image maintaining proportions and then crop it to the specified width and height
(resize-and-crop (file "tea-party/mad-hatter.jpg") 10 10) ; => #<BufferedImage width=10 height=10>

Turning BufferedImage into something useful

(require [image-resizer.format :as format])

;Saving as an auto-named file
(format/as-file
  (resize (file "tea-party/mad-hatter.jpg") 10 10)
  "/tmp/tea-party/mad-hatter.jpg") ; => "/tmp/tea-party/mad-hatter_10x5.jpg"

;Saving under a specific name
(format/as-file
  (resize (file "tea-party/mad-hatter.jpg") 10 10)
  "/tmp/tea-party/tiny-hatter.jpg"
  :verbatim) ; => "/tmp/tea-party/tiny-hatter.jpg"

;To a stream (Useful for s3)
(format/as-stream (resize (file "tea-party/mad-hatter.jpg") 10 10) "jpg") ; => #<ByteArrayInputStream>

Contributors

License

(The MIT License)

Copyright (c) 2013-present Joseph Wilk

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].