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
+9.7k Golang : Eroding and dilating image with OpenCV example
+12.7k Golang : Send data to /dev/null a.k.a blackhole with ioutil.Discard
+9.2k nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
+5.2k PHP : See installed compiled-in-modules
+12.4k Elastic Search : Return all records (higher than default 10)
+8.3k Swift : Convert (cast) Character to Integer?
+14k Golang : concatenate(combine) strings
+7.5k Golang : Process json data with Jason package
+13.8k Golang : Convert spaces to tabs and back to spaces example
+10.1k Golang : Compare files modify date example
+13.2k CodeIgniter : "Fatal error: Cannot use object of type stdClass as array" message