lossypng

package module
v0.0.0-...-375570b Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2017 License: Unlicense Imports: 3 Imported by: 0

README

Warning: This library should probably not be used just yet

lossypng

GoDoc

Library version of the lossypng command line tool.

Shrink PNG files by applying a lossy filter

Installation

go get -u github.com/peterhellberg/lossypng

Feel free to copy all or parts of this package into your own codebase.

Examples

Original image 320 KB

Original image

The optimized images were encoded to PNG using a png.Encoder{png.BestCompression}

Optimize(m, RGBAConversion, 10) 156 KB

Optimize(m, RGBAConversion, 10)

Optimize(m, GrayscaleConversion, 10) 40 KB

Optimize(m, GrayscaleConversion, 10)

Credit

This compression technique was invented by Michael Vinther for his excellent Windows program, Image Analyzer. It does much more than just compression. It was ported and improved by William MacKay.

I have just converted it into a library.

License

All code in lossypng is public domain. You may use it however you wish.

Documentation

Overview

Package lossypng is a library version of the lossypng command line tool.

Installation

go get -u github.com/peterhellberg/lossypng

Index

Constants

View Source
const (
	// NoConversion does not convert the image
	NoConversion = iota

	// GrayscaleConversion convert image to grayscale
	GrayscaleConversion

	// RGBAConversion convert image to 32-bit color
	RGBAConversion
)

Variables

This section is empty.

Functions

func Optimize

func Optimize(original image.Image, colorConversion int, quantization int) image.Image

Optimize optimizes an image using the selected color conversion and quantization

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