• Stars
    star
    102
  • Rank 335,584 (Top 7 %)
  • Language
    Go
  • Created about 10 years ago
  • Updated over 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A fast image resizer

T-REZ

A super fast image resizer build on top of opencv and jpeg-turbo.

--

This package keeps a good quality of images however is built for speed. It will strip out image informations like IPTC, EXIF, ColorSync profile, etc.

The benchmark below is just illustrative. This code is derived form a production version that process (at peek) more than 1000 images/s on a single machine.

Install

You need:

  • opencv
  • libjpeg (jpeg-turbo suggested)
  • libpng (optional if you want to read png files)

Macintosh

If you are on a mac and you have brew installed you can use this formula

brew install https://gist.githubusercontent.com/DAddYE/bd6a4819ec0bbb2efb0a/raw/opencv.rb

Linux

Install jpeg-turbo from sources:

libjpeg-turbo-1.3.1$ ./configure --with-jpeg8 --with-pic && make && sudo make install

and then opencv with:

opencv-2.4.9$ cmake -DBUILD_JASPER=OFF -DBUILD_JPEG=OFF \
-DJPEG_INCLUDE_DIR=/opt/libjpeg-turbo/include/ \
-DJPEG_LIBRARY=/opt/libjpeg-turbo/lib64/libturbojpeg.a -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF \
-DBUILD_opencv_java=OFF -DWITH_OPENEXR=ON -DWITH_QT=OFF -DWITH_TBB=OFF -DWITH_GSTREAMER=OFF \
-DWITH_GTK=OFF -DWITH_V4L=OFF -DBUILD_DOCS=OFF -DBUILD_NEW_PYTHON_SUPPORT=OFF  -DWITH_1394=OFF \
-DWITH_OPENCL=OFF -DENABLE_SSSE3=ON -DENABLE_SSE41=ON -DENABLE_SSE42=ON -DENABLE_AVX=ON -Wno-dev \
-DCMAKE_INSTALL_PREFIX=/usr

Finally:

go get github.com/daddye/trez

Features

It supports currently:

  • fit resize algo
  • fill resize algo
  • background color
  • gravity in case of fit
  • quality of jpeg (default 95)

TODO

  • trim borders
  • enlarge option

Benchmarks

On:

Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                24
On-line CPU(s) list:   0-23
Thread(s) per core:    2
Core(s) per socket:    6
Socket(s):             2
NUMA node(s):          2
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 45
Stepping:              7
CPU MHz:               1895.270
BogoMIPS:              3790.86
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              15360K
NUMA node0 CPU(s):     0-5,12-17
NUMA node1 CPU(s):     6-11,18-23

running 24 threads:

$ GOMAXPROCS=24 go run bench/main.go -file testdata/American_Dad.jpg -size 200x200 -workers 24

## Resize speed of 14000 resizes
  mean: 34.377864ms
   min: 20.395457ms
   max: 61.757311ms
   %99: 55.475588ms
stdDev: 4.781191ms
  rate: 700.16 ops (images resized per second)

LICENSE

Copyright (C) 2014 Davide D'Agostino

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.

More Repositories

1

foreverb

Small daemon framework for ruby, with logging, error handler, scheduling and much more.
Ruby
520
star
2

vips

Go Bindings for Vips (a super fast image processor)
Go
450
star
3

mini_record

ActiveRecord meets DataMapper, with MiniRecord you are be able to write schema inside your models.
Ruby
265
star
4

do

DO - IT! is a thin framework useful to manage remote servers through ssh.
Ruby
166
star
5

igo

Intermediate GoLang source representation
Go
142
star
6

leveldb

LevelDB for Ruby (embedded)
Ruby
126
star
7

lipsiadmin

Lipsiadmin is a new revolutionary admin for your projects. Lipsiadmin is based on Ext Js 3+. framework (with prototype adapter) and is ready for Rails 2.+. This admin is for newbie developper but also for experts, is not entirely written in javascript because the aim of developper wose build in a agile way web/site apps so we use extjs in a new intelligent way a mixin of β€œold” html and new ajax functions, for example ext manage the layout of page, grids, tree and errors, but form are in html code.
Ruby
105
star
8

githubwatcher

Github Growl Watcher, watch any project and get instant growl notifications for: updates, new watchers, forks and issues
Ruby
88
star
9

lightbox

LightBox Helper is a small but beautifull helper that automatize the process for include LightBox on our pages.
JavaScript
39
star
10

ruby_nsq

Ruby client for the NSQ realtime message processing system
Ruby
28
star
11

gruby

Go lang to Ruby transpiler
Go
26
star
12

soda.vim

Reinterpreted Soda Theme for Vim Users
Vim Script
21
star
13

lipsiablog

Lightweight, simple, fast, easy blogging engine written in rails and Lipsiadmin
JavaScript
17
star
14

exception-notifier

Exception Notifier Plugin for Rails, that send email notification and generate error pages that you can use with your controller Layout.
Ruby
13
star
15

google_tasks

This gem provides access to google tasks apis
Ruby
10
star
16

model

Naive sql to struct for go
Go
8
star
17

node.nim

Work in progress node pattern on the awesome Nimrod
Nim
7
star
18

goroutine

Simple goroutine model for Ruby.
Ruby
6
star
19

fiddler

Wrapper for Fiddler (Ruby 2.0 FFI impl)
Ruby
6
star
20

ruvy

FFI Bindings to Libuv (experimental)
Ruby
6
star
21

eva

Effortless event driven micro framework that runs on Ruby in a different syntax
Ruby
6
star
22

golia

WebSite Link and Speed Checker
Ruby
5
star
23

documents

Document nubble FS
Ruby
4
star
24

tomorrow.vim

Dark light version of new Tomorrow Theme
Vim Script
4
star
25

.vim

My vim editor, plugins, syntax and more.
Vim Script
3
star
26

forever

MOVED HERE: https://github.com/DAddYE/foreverb
3
star
27

wintersmith-perian

Browserify, Coffee, Stylus, UglifyJS and CleanCSS
CoffeeScript
3
star
28

gist

Repo as a gist
Nim
3
star
29

loop

A tiny Ruby program used to periodically execute a command.
Ruby
2
star
30

snippets

Snipmate custom snippets
2
star
31

.do

My Servo recipes
Ruby
1
star
32

yarv

RubyVM (yarv) compiler/decompiler, written in go.
Go
1
star
33

rosetta

One language to rule them all.
Ruby
1
star
34

homebrew-alt

My homebrews
Ruby
1
star
35

mrb

FFI bindings for mruby
Ruby
1
star
36

uv

Ruby bindings for libuv
Ruby
1
star
37

lipsiadmin-I18n

Repository for collecting Locale data for Lipsiadmin
1
star
38

igo.vim

Vim syntax for igo
Vim Script
1
star
39

coding-style

Coding style
1
star