Go binding for stb_image.h.
Load an image.RGBA
from some path on disk.
import "neilpa.me/go-stbi"
image, err := stbi.Load("path/to/image.jpeg")
// ...
There are also format specific sub-packages that register decoders for use
with the standard image.Decode
and image.DecodeConfig
methods.
import (
"image"
_ "neilpa.me/go-stbi/bmp"
_ "neilpa.me/go-stbi/gif"
_ "neilpa.me/go-stbi/jpeg"
_ "neilpa.me/go-stbi/png"
)
bmp, _, err := image.Decode("path/to/image.bmp")
gif, _, err := image.Decode("path/to/image.gif")
jpg, _, err := image.Decode("path/to/image.jpg")
png, _, err := image.Decode("path/to/image.png")
// ...
This code is released into the public domain.