Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

coalaura/xbm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xbm

Pure Go XBM image encoder/decoder.

Install

go get -u github.com/coalaura/xbm

Usage

Decode

package main

import (
	"fmt"
	"image"
	"os"

	"github.com/coalaura/xbm"
)

func main() {
	f, _ := os.Open("test.xbm")
	defer f.Close()

	img, err := xbm.Decode(f)
	if err != nil {
		panic(err)
	}

	fmt.Println(img.Bounds())
}

Encode

package main

import (
	"image"
	"image/color"
	"os"

	"github.com/coalaura/xbm"
)

func main() {
	img := image.NewGray(image.Rect(0, 0, 8, 8))
	img.SetGray(3, 3, color.Gray{Y: 255})

	f, _ := os.Create("out.xbm")
	defer f.Close()

	xbm.Encode(f, img, xbm.XBMOptions{Name: "test"})
}

About

pure go xbm decoder/encoder

Topics

Resources

Stars

Watchers

Forks

Languages