Skip to content

Latest commit

 

History

History
43 lines (30 loc) · 1.04 KB

README.md

File metadata and controls

43 lines (30 loc) · 1.04 KB

go-stbi

CI GoDoc

Go binding for stb_image.h.

Usage

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")
// ...

Licence

This code is released into the public domain.