Using image (DecodeConfig) in Go

Posted by GoDoc
Public (Editable by Users)

Package image implements a basic 2-D image library.

Go
Edit
package main

import (
	"encoding/base64"
	"fmt"
	"image"
	"log"
	"strings"
)

func main() {
	reader := base64.NewDecoder(base64.StdEncoding, strings.NewReader(data))
	config, format, err := image.DecodeConfig(reader)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println("Width:", config.Width, "Height:", config.Height, "Format:", format)
}