快速调整图片大小:T-REZ

jopen 10年前

一个超级快的图片大小调整Go库,构建opencv 和 jpeg-turbo 之上。
这个包能够保持图片品质,虽然专注于速度。它会剔除图片元信息如IPTC, EXIF, ColorSync profile等。

特性

当前支持:

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

基准测试

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

运行24个线程:

$ 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)

 

项目主页:http://www.open-open.com/lib/view/home/1416982329768