Golang image.gif.DecodeConfig function example
package image/gif
Golang image.gif.DecodeConfig function usage example
package main
import (
"fmt"
"image/gif"
"os"
)
func main() {
imgfile, err := os.Open("./img.gif")
if err != nil {
fmt.Println("img.gif file not found!")
os.Exit(1)
}
defer imgfile.Close()
imgCfg, err := gif.DecodeConfig(imgfile)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
cmodel := imgCfg.ColorModel
width := imgCfg.Width
height := imgCfg.Height
fmt.Println(cmodel)
fmt.Println(width)
fmt.Println(height)
}
Reference :
Advertisement
Something interesting
Tutorials
+22.4k Generate checksum for a file in Go
+8.3k Golang : Ackermann function example
+13.3k Golang : Read XML elements data with xml.CharData example
+15k Golang : How to check if IP address is in range
+10.9k How to test Facebook App on localhost ?
+10.2k Golang : cannot assign type int to value (type uint8) in range error
+36.1k Golang : How to split or chunking a file to smaller pieces?
+6.5k Golang : Check if password length meet the requirement
+5.7k Cash Flow : 50 days to pay your credit card debt
+18.2k Golang : How to get hour, minute, second from time?
+19.7k Golang : Count JSON objects and convert to slice/array
+4.7k Fix Google Analytics Redundant Hostnames problem