Skip to content

JSON encoder and decoder for PNG images.

License

Notifications You must be signed in to change notification settings

eminmuhammadi/imgx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

imgx

JSON encoder and decoder for PNG images. Example can be found here.

Usage

Encoding

package main

import (
	"fmt"

	imgx "github.com/eminmuhammadi/imgx"
)

data := imgx.Data{}

file, err := imgx.Import("input.png")
if err != nil {
	panic(err)
}

data, err = imgx.Encode(file)
if err != nil {
	panic(err)
}

json, err := data.Json()
if err != nil {
	panic(err)
}

fmt.Println(json)

Decoding

package main

import (
    "fmt"

    imgx "github.com/eminmuhammadi/imgx"
)

data := imgx.Data{}
json := "{...}"

err := data.DecodeJson(json)
if err != nil {
	t.Error(err)
}

err = data.Save("output.png")
if err != nil {
	panic(err)
}

Releases

No releases published

Packages

No packages published

Languages