Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/imazen/imageflow-go
Go bindings for Imageflow -> https://github.com/imazen/imageflow
https://github.com/imazen/imageflow-go
batch-processing fast golang http image-processing rust
Last synced: about 2 months ago
JSON representation
Go bindings for Imageflow -> https://github.com/imazen/imageflow
- Host: GitHub
- URL: https://github.com/imazen/imageflow-go
- Owner: imazen
- License: agpl-3.0
- Created: 2020-05-10T17:35:24.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-12-07T04:48:25.000Z (about 2 years ago)
- Last Synced: 2024-06-20T15:44:09.445Z (6 months ago)
- Topics: batch-processing, fast, golang, http, image-processing, rust
- Language: Go
- Homepage:
- Size: 56.6 KB
- Stars: 17
- Watchers: 5
- Forks: 6
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Go Binding for [Imageflow](https://github.com/imazen/imageflow)
![Windows](https://github.com/imazen/imageflow-go/workflows/Windows/badge.svg)![Macos](https://github.com/imazen/imageflow-go/workflows/Macos/badge.svg)![Linux](https://github.com/imazen/imageflow-go/workflows/Linux/badge.svg)
Quickly scale or modify images and optimize them for the web.
If the AGPLv3 does not work for you, you can get a commercial license on a sliding scale. If you have more than 1 server doing image processing your savings should cover the cost.
Docs are [here](https://pkg.go.dev/github.com/imazen/imageflow-go)
# Installation
Imageflow dependents on `libimageflow` for image processing capabilities. `libimageflow` is available as the static and dynamic shared library on Linux and macOS. Currently `libimageflow` is available as a dynamic library for Windows. Prebuilt shared libraries are available [here](https://github.com/imazen/imageflow/releases). Add `libimageflow`to OS path. Then it can be downloaded using`go get`.
```bash
$ go get github.com/imazen/imageflow-go
```# Usage
A simple go program to create two image of different size.
```go
package main;import (
"io/ioutil"imageflow "github.com/imazen/imageflow-go"
)func main(){
step:=imageflow.NewStep()
data,_:=step
.Decode(imageflow.NewURL("https://jpeg.org/images/jpeg2000-home.jpg"))
.Branch(func(step *imageflow.Steps){
step
.ConstrainWithin(200,200)
.Encode(imageflow.NewFile("test_1.jpg"),imageflow.MozJPEG{})
}).ConstrainWithin(400,400)
.Encode(imageflow.GetBuffer("test"),imageflow.MozJPEG{})
.Execute()
ioutil.WriteFile("test_2.jpeg",data["test"],0644)
}```