Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
T

trez

> 编程语言
Open source

A fast image resizer

100 stars0 likes1 views
WebsiteGitHub

About

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

bash
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:

bash
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:

…

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.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Go

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言