项目地址:https://github.com/pierrre/imageserver
简介
An image server toolkit in Go (Golang)【Go中的图像服务器工具包】
几年前的项目了,今天偶然又看到了,仍然还是1.9K的人气,作者已经断更~
开源的项目嘛,能用就可以了~,上手玩玩,文章主要采用了github里的示例。
但有一个大点【HTTP server】,也就是项目是可以最终作为api扩展给业务使用,喜欢的朋友可以深入试玩。
功能模块
- HTTP server
- Resize (GIFT, nfnt resize, Graphicsmagick)
- Rotate
- Crop
- Convert (JPEG, GIF (animated), PNG , BMP, TIFF, ...)
- Cache (groupcache, Redis, Memcache, in memory)
- Gamma correction
- Fully modular
示例
- Simple
- Advanced
- Cache
- Groupcache
- HTTP Source
- Mandelbrot (see interactive demo)
以下示例来自项目Advanced包中
调整图片大小
参数 | 示例 |
width=200 | |
height=200 | |
width=200&height=200 | |
width=200&height=200&mode=fit | |
width=200&height=200&mode=fill |
旋转
参数 | 示例 |
rotation=90 | |
rotation=45&background=ffaa88 |
裁剪
Format: min_x,min_y|max_x,max_y
参数 | 示例 |
crop=556,111|2156,1711 | |
crop=956,511|1756,1311 | |
crop=1252,799|1460,1022 |
GIF动画
Original | Resized |
重采样
Resampling | Rings | Large |
Nearest neighbor | ||
Box | ||
Linear | ||
Cubic | ||
Lanczos |
调整图片质量
JPEG quality | Result |
5% | |
10% | |
50% |
本文暂时没有评论,来添加一个吧(●'◡'●)