All Projects → vicanso → tiny

vicanso / tiny

Licence: Apache-2.0 license
compress data for better performance

Programming Languages

go
31211 projects - #10 most used programming language
Dockerfile
14818 projects
Makefile
30231 projects

Projects that are alternatives of or similar to tiny

Flyimg
Dockerized PHP7 application runs as a Microservice to resize and crop images on the fly. Get optimised images with MozJPEG, WebP or PNG using ImageMagick. Includes face detection, cropping, face blurring, image rotation and many other options. Abstract storage based on FlySystem in order to store images on any provider (local, AWS S3...).
Stars: ✭ 762 (+3528.57%)
Mutual labels:  png, compression, crop, webp
pyrus-cramjam
Thin Python wrapper to de/compression algorithms in Rust - lightweight & no dependencies
Stars: ✭ 40 (+90.48%)
Mutual labels:  compression, brotli, snappy, lz4
EasyCompressor
⚡ A compression library that implements many compression algorithms such as LZ4, Zstd, LZMA, Snappy, Brotli, GZip, and Deflate. It helps you to improve performance by reducing Memory Usage and Network Traffic for caching.
Stars: ✭ 167 (+695.24%)
Mutual labels:  compression, brotli, snappy, lz4
Archiver
Easily create & extract archives, and compress & decompress files of various formats
Stars: ✭ 3,373 (+15961.9%)
Mutual labels:  brotli, snappy, lz4
zstdmt
Multithreading Library for Brotli, Lizard, LZ4, LZ5, Snappy and Zstandard
Stars: ✭ 107 (+409.52%)
Mutual labels:  brotli, snappy, lz4
imagecodecs
Image transformation, compression, and decompression codecs. Forked from https://pypi.org/project/imagecodecs
Stars: ✭ 56 (+166.67%)
Mutual labels:  png, webp, lz4
box
Box - Open Standard Archive Format, a zip killer.
Stars: ✭ 38 (+80.95%)
Mutual labels:  compression, brotli, snappy
Sharp
High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, AVIF and TIFF images. Uses the libvips library.
Stars: ✭ 21,131 (+100523.81%)
Mutual labels:  png, crop, webp
yoga-image-optimizer
A graphical tool to convert and optimize JPEG, PNG and WebP images (based on YOGA)
Stars: ✭ 85 (+304.76%)
Mutual labels:  png, webp, mozjpeg
Bimg
Go package for fast high-level image processing powered by libvips C library
Stars: ✭ 1,394 (+6538.1%)
Mutual labels:  png, crop, webp
Lilliput
Resize images and animated GIFs in Go
Stars: ✭ 1,690 (+7947.62%)
Mutual labels:  png, crop, webp
video thumbnail
This plugin generates thumbnail from video file or URL. It returns image in memory or writes into a file. It offers rich options to control the image format, resolution and quality. Supports iOS and Android.
Stars: ✭ 159 (+657.14%)
Mutual labels:  png, webp
AppThinning
Make app thinner. Help you find large files and compress png, gif, jpg, svg files. 应用程序瘦身工具,帮助你找到大文件,压缩png、gif、jpg、svg等文件。
Stars: ✭ 22 (+4.76%)
Mutual labels:  png, compression
wordpress-plugin
Speed up your WordPress website. Optimize your JPEG and PNG images automatically with TinyPNG.
Stars: ✭ 78 (+271.43%)
Mutual labels:  png, compression
lz4ultra
Optimal LZ4 compressor, that produces files that decompress faster while keeping the best compression ratio
Stars: ✭ 49 (+133.33%)
Mutual labels:  compression, lz4
wasm-codecs
WebAssembly codecs for mozjpeg, oxipng, gifsicle and webp.
Stars: ✭ 48 (+128.57%)
Mutual labels:  webp, mozjpeg
snappy
Fastest Snappy compression library in Node.js
Stars: ✭ 110 (+423.81%)
Mutual labels:  compression, snappy
create-optimize-images
♻️ Reusable, scalable, bash scripts to create and optimize images.
Stars: ✭ 39 (+85.71%)
Mutual labels:  png, webp
Imageprocessor
📷 A fluent wrapper around System.Drawing for the processing of image files.
Stars: ✭ 2,452 (+11576.19%)
Mutual labels:  png, webp
py-lz4framed
LZ4-frame library for Python (via C bindings)
Stars: ✭ 42 (+100%)
Mutual labels:  compression, lz4

tiny

提供图片的转换处理以及文本的压缩,有HTTPGRPC的调用方式,建议配合tiny-site使用。

  • png PNG的优化处理使用pngquant

  • jpeg JEPG的优化处理使用mozjpeg

  • avif AVIF的优化处理使用cavif

  • 图片输出支持webp, jpeg, png, avif

  • 数据压缩输出支持brotli, gzip, snappy, lz4, zstd

编译proto

需要先安装protoc-gen-gofast

go get -d github.com/gogo/protobuf/protoc-gen-gofast
make protoc

启动

docker run -d --restart=always \
  -p 7001:7001 \
  -p 7002:7002 \
  --name=tiny \
  vicanso/tiny

其中7001提供HTTP服务,7002提供GRPC服务。

示例

以brotli方式压缩文件(需要注意,只有HTTPS或者以IP形式打开,chrome才支持br):

curl 'http://127.0.0.1:7001/texts/optim?output=br&quality=11&url=https://cdn.staticfile.org/jquery/3.4.1/jquery.min.js'

以POST的形式指定文本压缩:

curl -XPOST -H 'Content-Type:application/json' -d '{
	"data": "strings.........",
	"output": "gzip"
}' 'http://127.0.0.1:7001/texts/optim'

将png转换为webp:

curl 'http://127.0.0.1:7001/images/optim?output=webp&quality=80&url=https://www.baidu.com/img/bd_logo1.png'

以POST的形式指定图片转换:

curl -XPOST -H 'Content-Type:application/json' -d '{
	"data": "/9j/2wCEAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDIBCQkJDAsMGA0NGDIhHCEyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMv/AABEIACgAUAMBIgACEQEDEQH/xAGiAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgsQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+gEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoLEQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqa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R294+qS2cFkfN2xwebluzY7kduD1ro6zdf/AOQHdf7o/mKAOL8FQ3Fx4u1K9mvbyQ4wry25QXCD5QWyOMfLgf4V113r7WuoPZpo2q3JXH72GAeWcgHhmYA9azvCv/HzL/1z/qK6mgDCuNY1sEfZfDFxID3mu4Y8fkzU57jxLLCDDp2mW8npNeO+PwWMfzrbooAx7BPEZkQ6jPpSoD8yW8MhJHszOMfka8+8Q6TP4U8awarp8PlWkr7oSkPmIshBBj25HU56YwDx0xXrNcj8QP8Ajw0n/sJw/wAmoAxbfQ9X8W+IG127RtNjgVRaLLFliynIJQ/w5yT9eK7TSNSuLsy2t/aNbX9vgShQTG4PR427qcdOo5B6VetP+PSL/dFQR/8AIbuP+vaL/wBCkoA//9k=",
	"source": "jpeg",
	"output": "jpeg",
	"quality": 80,
	"width": 60,
	"height": 0
}' 'http://127.0.0.1:7001/images/optim'

客户端

tiny客户端主要用于图片预处理,可以将指定目录下的所有图片压缩优化,参数如下:

Usage of tiny:
  -filter string
    	filter regexp for image (default ".(png|jpg|jpeg)$")
  -jpeg int
    	the quality of jpeg, it should be >= 0 and <= 100 (default 80)
  -png int
    	the quality of png, it should be >= 0 and <= 100 (default 90)
  -server string
    	grpc server address (default "tiny.aslant.site:7002")
  -source string
    	search path (default ".")
  -target string
    	optim target path, new image will save to this path
  -webp int
    	the quality of webp, it should be >= 0 and <= 100

平时常用中,建议启动自己的tiny server,将-server参数指定为该服务,避免网络传输带来的压缩延迟。使用默认参数将/Downloads目录下的图片压缩优化并保存至/tmp/images中:

tiny -source=/Downloads -target=/tmp/images
546 / 546 [----------------------------------------------------------------------] 100.00% 44 p/s
********************************TINY********************************
Optimize images is done, use:12.7260134s
Success(538) Fail(8)
Space size reduce from 28 MB to 7.6 MB
Fails: /Downloads/res_1566890283138/assets/imgs/bg_erweima.png rpc error: code = Unknown desc = message=data can not be nil
/Downloads/res_1566890283138/assets/imgs/breakOrWith.png rpc error: code = Unknown desc = png: invalid format: not a PNG file
/Downloads/res_1566890283138/assets/imgs/default_ishare.png rpc error: code = Unknown desc = png: invalid format: not a PNG file
/Downloads/res_1566890283138/assets/screen/750x1134.png rpc error: code = Unknown desc = message=data can not be nil
/Downloads/res_1566890283138/assets/screen/[email protected] rpc error: code = Unknown desc = message=data can not be nil
/Downloads/res_1566890283138/assets/screen/[email protected] rpc error: code = Unknown desc = message=data can not be nil
/Downloads/res_1566890283138/assets/screen/splash-port-pdpi.png rpc error: code = Unknown desc = message=data can not be nil
/Downloads/res_1566890283138/assets/screen/splash-port-xhdpi.png rpc error: code = Unknown desc = message=data can not be nil
********************************TINY********************************
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].