Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/neilpa/go-stbi
Go binding for stb_image.h
https://github.com/neilpa/go-stbi
bmp go golang image-processing jpeg png stb-image
Last synced: about 1 month ago
JSON representation
Go binding for stb_image.h
- Host: GitHub
- URL: https://github.com/neilpa/go-stbi
- Owner: neilpa
- Created: 2019-12-07T21:34:12.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-03-24T00:07:45.000Z (over 4 years ago)
- Last Synced: 2024-08-03T23:18:48.320Z (4 months ago)
- Topics: bmp, go, golang, image-processing, jpeg, png, stb-image
- Language: C
- Size: 86.9 KB
- Stars: 9
- Watchers: 3
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-golang-repositories - go-stbi
README
# go-stbi
[![CI](https://github.com/neilpa/go-stbi/workflows/CI/badge.svg)](https://github.com/neilpa/go-stbi/actions/)
[![GoDoc](https://godoc.org/neilpa.me/go-stbi?status.svg)](https://godoc.org/neilpa.me/go-stbi)Go binding for [stb_image.h][].
## Usage
Load an `image.RGBA` from some path on disk.
```go
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.```go
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.
[stb_image.h]: https://github.com/nothings/stb/blob/f67165c2bb2af3060ecae7d20d6f731173485ad0/stb_image.h