Skip to content

neilpa/go-stbi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.