Go bindings for libimagequant https://code.ivysaur.me/imagequant/
Go to file
mappu bdcc2f09a6 doc: update README for v2.12.6 release 2020-07-25 12:56:51 +12:00
cmd/gopngquant go.mod: we are v2 2020-07-25 12:56:37 +12:00
doc doc: track documentation image 2020-05-06 18:24:08 +12:00
.gitignore hg2git: convert ignores/tags files 2018-12-31 16:33:17 +13:00
Attributes.go add ISC license headers 2016-11-24 21:28:55 +13:00
COPYRIGHT libimagequant (2.8-git-a425e83) GPLv3+ 2016-11-20 13:38:15 +13:00
Histogram.go add ISC license headers 2016-11-24 21:28:55 +13:00
Image.go add ISC license headers 2016-11-24 21:28:55 +13:00
README.md doc: update README for v2.12.6 release 2020-07-25 12:56:51 +12:00
Result.go add ISC license headers 2016-11-24 21:28:55 +13:00
blur.c libimagequant (2.8-git-a425e83) GPLv3+ 2016-11-20 13:38:15 +13:00
blur.h vendor: update pngquant to 2.12.6 2020-07-25 12:55:55 +12:00
cflags_linux.go cflags: remove performance flags, to fix build with new Go whitelist 2018-12-31 16:32:07 +13:00
cflags_windows.go split up cgo CFLAGS into files with separate build tags 2017-03-03 18:16:40 +13:00
go.mod go.mod: we are v2 2020-07-25 12:56:37 +12:00
imagequant.go split up cgo CFLAGS into files with separate build tags 2017-03-03 18:16:40 +13:00
kmeans.c vendor: update pngquant to 2.12.6 2020-07-25 12:55:55 +12:00
kmeans.h update bundled libimagequant from 2.8.0 to 2.9.0 2017-03-03 18:24:02 +13:00
libimagequant.c vendor: update pngquant to 2.12.6 2020-07-25 12:55:55 +12:00
libimagequant.h vendor: update pngquant to 2.12.6 2020-07-25 12:55:55 +12:00
mediancut.c vendor: update pngquant to 2.12.6 2020-07-25 12:55:55 +12:00
mediancut.h vendor: update pngquant to 2.12.6 2020-07-25 12:55:55 +12:00
mempool.c update bundled pngquant to v2.12.2 2018-12-31 16:35:00 +13:00
mempool.h update bundled pngquant to v2.12.2 2018-12-31 16:35:00 +13:00
nearest.c update bundled pngquant to v2.12.2 2018-12-31 16:35:00 +13:00
nearest.h vendor: update pngquant to 2.12.6 2020-07-25 12:55:55 +12:00
pam.c vendor: update pngquant to 2.12.6 2020-07-25 12:55:55 +12:00
pam.h vendor: update pngquant to 2.12.6 2020-07-25 12:55:55 +12:00

README.md

imagequant

Go bindings for libimagequant

libimagequant is a library for lossy recompression of PNG images to reduce their filesize. It is used by the pngquant tool. This go-imagequant project is a set of bindings for libimagequant to enable its use from the Go programming language.

This binding was written by hand. The result is somewhat more idiomatic than an automated conversion, but some defer foo.Release() calls are required for memory management.

Usage

Usage example is provided by a sample utility cmd/gopngquant which mimics some functionality of the upstream pngquant.

The sample utility has the following options:

Usage of gopngquant:
  -In string
        Input filename
  -Out string
        Output filename
  -Speed int
        Speed (1 slowest, 10 fastest) (default 3)
  -Version

Building

This package can be installed via go get: go get code.ivysaur.me/imagequant

Import the package as code.ivysaur.me/imagequant/v2 and compile via go build.

This is a CGO package and requires a C compiler installed. However, if you use go install then future invocations of go build do not require the C compiler to be present.

The imagequant.go file also declares a number of CFLAGS for GCC that allow the included libimagequant to build in a reasonably optimal way without using the upstream configure/make scripts.

License

I am releasing this binding under the ISC license, however, libimagequant itself is released under GPLv3-or-later and/or commercial licenses. You must comply with the terms of such a license when using this binding in a Go project.

Changelog

2020-07-25 v2.12.6

  • Update bundled libimagequant from 2.12.2 to 2.12.6
  • Fix missing v2 in go.mod file causing failure to import in Modules mode

2018-12-31 v2.12.2-go1.2

  • go-imagequant: Update bundled libimagequant from 2.9.0 to 2.12.2
  • build: Switch to Go Modules
  • build: Update bundled CFLAGS for new CGo whitelist (reduces performance)
  • build: Remove nonportable Cygwin makefile

2017-03-03 v2.9.0-go1.1

2016-11-24 v2.8.0-go1.0

See also