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
+18.6k Golang : Convert(cast) bytes.Buffer or bytes.NewBuffer type to io.Reader
+7.3k Golang : Reverse text lines or flip line order example
+7.7k Golang : On lambda, anonymous, inline functions and function literals
+5.3k Golang : Get missing location after unmarshal binary and gob decode time.
+38.1k Golang : Convert to io.ReadSeeker type
+14k Golang : Get HTTP protocol version example
+17k Golang : Aligning strings to right, left and center with fill example
+4.8k Linux/Unix/PHP : Restart PHP-FPM
+8.4k Golang : does not implement flag.Value (missing Set method)
+6.5k Android Studio : AlertDialog to get user attention example