<< More Tutorials
How to use rethumb in Go?
To use rethumb in Go try the following code:
package main
import (
"net/http";
"io/ioutil"
)
func main() {
resp, err := http.Get("http://api.rethumb.com/v1/width/100/http://factor45.org/images/beach.jpg")
check(err)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
check(err)
err = ioutil.WriteFile("beach.thumb.jpg", body, 0644)
check(err)
}
func check(e error) {
if e != nil {
panic(e)
}
}
Start using this example now
Use the following commands to get started:
$ git clone https://github.com/rethumb/rethumb-go-examples.git
$ cd rethumb-go-examples
$ go build generic.go
$ ./generic
More examples using Go
How to use rethumb in Go?
How to resize an image by width in Go using rethumb?
How to resize an image by height in Go using rethumb?
How to resize an image by width and height in Go using rethumb?
How to create a square thumbnail from an image in Go using rethumb?
How to read Exif data in json format from an image in Go using rethumb?
How to make an image responsive in Go using rethumb?
How to read GPS coordinates from an image in Go using rethumb?
How to convert an image to JPG, GIF, PNG, TIF or WebP in Go using rethumb?
How to resize an image to cover any dimensions in Go using rethumb?