一个快速的图像缩放器
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.
You need:
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.rbInstall jpeg-turbo from sources:
libjpeg-turbo-1.3.1$ ./configure --with-jpeg8 --with-pic && make && sudo make installand 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=/usrFinally:
go get github.com/daddye/trezIt supports currently:
fit resize algofill resize algobackground colorgravity in case of fitquality of jpeg (default 95)trim bordersenlarge optionOn:
…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)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,或尚未同步最近议题。