pngpal

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2018 License: MIT Imports: 3 Imported by: 0

README

pngpal

Go Report Card GoDoc Build Status

Friendly command line tool to losslessly convert a PNG to a palleted PNG if possible. It simply rejects images if it cannot be done losslessly.

Also usable as a library to convert images in general to paletted images.

Examples

PNG-24 PNG-8 (Palleted)
PNG-24 Cat PNG-8 Cat
21kb 9kb

Usage

# Replace PNG in-place
$ pngpal file.png

# Save to new file
$ pngpal -o new.png old.png

Installation

Binaries

See: Releases.

From Source
$ go get -u -v github.com/donatj/pngpal/cmd/pngpal

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTooManyColors = fmt.Errorf("too many colors for palette")

ErrTooManyColors is returned when there is too many colors for a palleted image. E.g. Greater than 256

Functions

func ImageToPaletted

func ImageToPaletted(img image.Image) (*image.Paletted, error)

ImageToPaletted losslessly converts an image.Image to an image.Paletted if possible.

If the passed image.Image already is an image.Paletted it will be returned as is without modification.

If the passed image.Image contains more than 256 colors a ErrTooManyColors will be returned

Types

This section is empty.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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