Last active
April 3, 2018 03:00
-
-
Save watanabeyu/d7b4ac8bb6e3e616c09a6a0aecf34401 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"image" | |
_ "image/jpeg" | |
_ "image/png" | |
"log" | |
"net/http" | |
) | |
func main() { | |
response, err := http.Get("https://golang.org/doc/gopher/doc.png") | |
if err != nil { | |
panic(err) | |
} | |
defer response.Body.Close() | |
conf, _, err := image.DecodeConfig(response.Body) | |
if err != nil { | |
log.Fatal(err) | |
} | |
fmt.Printf("Width=%d, Height=%d\n", conf.Width, conf.Height) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment