All Projects → kolesa-team → go-webp

kolesa-team / go-webp

Licence: MIT license
Simple and fast webp library for golang

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to go-webp

BeFoR64
BeFoR64, Base64 encoding/decoding library for FoRtran poor men
Stars: ✭ 17 (-81.32%)
Mutual labels:  encoding, decoding
Elixir Json
Native JSON library for Elixir
Stars: ✭ 216 (+137.36%)
Mutual labels:  encoding, decoding
Packetserial
An Arduino Library that facilitates packet-based serial communication using COBS or SLIP encoding.
Stars: ✭ 177 (+94.51%)
Mutual labels:  encoding, decoding
Phpasn1
A PHP library to encode and decode arbitrary ASN.1 structures using ITU-T X.690 encoding rules.
Stars: ✭ 136 (+49.45%)
Mutual labels:  encoding, decoding
multibase
multi base encoding/decoding utility
Stars: ✭ 15 (-83.52%)
Mutual labels:  encoding, decoding
Ffmpeg Video Player
An FFmpeg and SDL Tutorial.
Stars: ✭ 149 (+63.74%)
Mutual labels:  encoding, decoding
Jsonlab
JSONLab: a native JSON/UBJSON/MassagePack encoder/decoder for MATLAB/Octave
Stars: ✭ 202 (+121.98%)
Mutual labels:  encoding, decoding
Libbrotli
meta project to build libraries from the brotli source code
Stars: ✭ 110 (+20.88%)
Mutual labels:  encoding, decoding
js-multibase
JavaScript implementation of the multibase specification
Stars: ✭ 22 (-75.82%)
Mutual labels:  encoding, decoding
ciphr
CLI crypto swiss-army knife for performing and composing encoding, decoding, encryption, decryption, hashing, and other various cryptographic operations on streams of data from the command line; mostly intended for ad hoc, infosec-related uses.
Stars: ✭ 100 (+9.89%)
Mutual labels:  encoding, decoding
Lerc
Limited Error Raster Compression
Stars: ✭ 126 (+38.46%)
Mutual labels:  encoding, decoding
morton-nd
A header-only compile-time Morton encoding / decoding library for N dimensions.
Stars: ✭ 78 (-14.29%)
Mutual labels:  encoding, decoding
Codability
Useful helpers for working with Codable types in Swift
Stars: ✭ 125 (+37.36%)
Mutual labels:  encoding, decoding
Go.geojson
Encoding and decoding GeoJSON <-> Go
Stars: ✭ 172 (+89.01%)
Mutual labels:  encoding, decoding
Vxg.media.sdk.android
Market leading Android SDK with encoding, streaming & playback functionality
Stars: ✭ 119 (+30.77%)
Mutual labels:  encoding, decoding
Base X
Encode/decode any base
Stars: ✭ 191 (+109.89%)
Mutual labels:  encoding, decoding
Bitmatch
A Rust crate that allows you to match, bind, and pack the individual bits of integers.
Stars: ✭ 82 (-9.89%)
Mutual labels:  encoding, decoding
Binary
Generic and fast binary serializer for Go
Stars: ✭ 86 (-5.49%)
Mutual labels:  encoding, decoding
Stego
🦕 stego is a steganographic swiss army knife.
Stars: ✭ 220 (+141.76%)
Mutual labels:  encoding, decoding
sms
A Go library for encoding and decoding SMSs
Stars: ✭ 37 (-59.34%)
Mutual labels:  encoding, decoding

logo

go-webp

Build Status GoDoc Go Report codecov

Golang Webp library for encoding and decoding, using C binding for Google libwebp

Requirements

libwebp

Benchmarks

% go test -bench "^BenchmarkDecode" ./webp                                                                                
goos: darwin
goarch: amd64
pkg: github.com/kolesa-team/go-webp/webp
BenchmarkDecodeLossy-12                       45          25965139 ns/op
BenchmarkDecodeXImageLossy-12                 13          90735879 ns/op
BenchmarkDecodeLossless-12                    64          18887482 ns/op
BenchmarkDecodeXImageLossless-12              27          42422596 ns/op
PASS
ok      github.com/kolesa-team/go-webp/webp     7.877s

Install libwebp

MacOS:

brew install webp

Linux:

sudo apt-get update
sudo apt-get install libwebp-dev

Install

go get -u github.com/kolesa-team/go-webp

Examples

Decode:

package main

import (
	"image/jpeg"
	"log"
	"os"

	"github.com/kolesa-team/go-webp/decoder"
	"github.com/kolesa-team/go-webp/webp"
)

func main() {
	file, err := os.Open("test_data/images/m4_q75.webp")
	if err != nil {
		log.Fatalln(err)
	}

	output, err := os.Create("example/output_decode.jpg")
	if err != nil {
		log.Fatal(err)
	}
	defer output.Close()

	img, err := webp.Decode(file, &decoder.Options{})
	if err != nil {
		log.Fatalln(err)
	}

	if err = jpeg.Encode(output, img, &jpeg.Options{Quality:75}); err != nil {
		log.Fatalln(err)
	}
}
go run example/decode/main.go

Encode

package main

import (
	"github.com/kolesa-team/go-webp/encoder"
	"github.com/kolesa-team/go-webp/webp"
	"image/jpeg"
	"log"
	"os"
)

func main() {
	file, err := os.Open("test_data/images/source.jpg")
	if err != nil {
		log.Fatalln(err)
	}

	img, err := jpeg.Decode(file)
	if err != nil {
		log.Fatalln(err)
	}

	output, err := os.Create("example/output_decode.webp")
	if err != nil {
		log.Fatal(err)
	}
	defer output.Close()

	options, err := encoder.NewLossyEncoderOptions(encoder.PresetDefault, 75)
	if err != nil {
		log.Fatalln(err)
	}

	if err := webp.Encode(output, img, options); err != nil {
		log.Fatalln(err)
	}
}
go run example/encode/main.go

TODO

  • return aux stats
  • container api
  • incremental decoding

License

MIT licensed. See the LICENSE file for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].