imgx

command module
v0.0.0-...-e6b27cb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2022 License: MIT Imports: 7 Imported by: 0

README

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)
}

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL