Code Monkey home page Code Monkey logo

imageflow-go's Introduction

Go Binding for Imageflow

WindowsMacosLinux

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

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. Add libimageflowto OS path. Then it can be downloaded usinggo get.

$ go get github.com/imazen/imageflow-go

Usage

A simple go program to create two image of different size.

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.