Create a free account and start processing
your images smarter.
Click Here to go Picsmize API docs for full API reference.
To install the Picsmize library, the syntax for installing the command line goes like this;
$ go get github.com/picsmize/picsmize-golang
If you don't have your API Key just yet, you can Sign Up for a free account.
This Picsmize GoLang module allows all the operations available with the Picsmize API. The following example uses image Fetch
, Compress
, Resize
and Filter
with different mode and get the output file directly with ToJSON()
method:
package main
import (
"fmt"
"github.com/picsmize/picsmize-go"
)
func main() {
pics, err := picsmize.Init("your-api-key")
if err != nil {
panic(err)
}
/**
* Use of Fetch() method
*/
res, err := pics.Fetch("https://www.example.com/image.jpg").
/**
* Use of Compress() method with low mode
*/
Compress(picsmize.Options{
"level": "low",
}).
/**
* Use of Resize() method with auto mode
* and width set to 400
*/
Resize("auto", picsmize.Options{
"width": 400,
}).
/**
* Use of Filter() blur method with gaussian mode
* and value set to 10
*/
Filter("auto", picsmize.Options{
"mode": "gaussian",
"value": 10
}).
/**
* Call ToJSON() on the final step and return the JSON response
*/
ToJSON()
if err != nil {
panic(err)
}
/**
* You'll find the full JSON metadata within the `res` variable.
*/
fmt.Println(res)
}