Discover Packages
github.com/gen2brain/webp
package
module
Version:
v0.2.7
Opens a new window with list of versions in this module.
Published: Mar 17, 2024
License: MIT
Opens a new window with license information.
Imports: 18
Opens a new window with list of imports.
Imported by: 15
Opens a new window with list of known importers.
README
README
¶
webp
Go encoder/decoder for WebP Image File Format with support for animated WebP images (decode only).
Based on libwebp compiled to WASM and used with wazero runtime (CGo-free).
The library will first try to use a dynamic/shared library (if installed) via purego and will fall back to WASM.
Benchmark
goos: linux
goarch: amd64
pkg: github.com/gen2brain/webp
cpu: 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz
BenchmarkDecodeStd-8 157 7639585 ns/op 473683 B/op 13 allocs/op
BenchmarkDecodeWasm-8 129 9359457 ns/op 1334194 B/op 50 allocs/op
BenchmarkDecodeDynamic-8 313 3751982 ns/op 1335973 B/op 53 allocs/op
BenchmarkDecodeTranspiled-8 (1) 138 8562133 ns/op 1335622 B/op 52 allocs/op
BenchmarkDecodeCGo1-8 (2) 300 3897300 ns/op 1333630 B/op 21 allocs/op
BenchmarkDecodeCGo2-8 (3) 314 3801195 ns/op 1334020 B/op 22 allocs/op
BenchmarkDecodeConfigStd-8 1653494 712.9 ns/op 3600 B/op 6 allocs/op
BenchmarkDecodeConfigWasm-8 1713109 694.0 ns/op 368 B/op 20 allocs/op
BenchmarkDecodeConfigDynamic-8 2406602 503.6 ns/op 456 B/op 9 allocs/op
BenchmarkDecodeConfigTranspiled-8 (1) 2568049 450.0 ns/op 3600 B/op 6 allocs/op
BenchmarkDecodeConfigCGo1-8 (2) 8920566 148.3 ns/op 128 B/op 3 allocs/op
BenchmarkDecodeConfigCGo2-8 (3) 24165 50703 ns/op 285376 B/op 20 allocs/op
BenchmarkEncodeWasm-8 10 103065077 ns/op 133804 B/op 17 allocs/op
BenchmarkEncodeDynamic-8 52 22548953 ns/op 26388 B/op 13 allocs/op
BenchmarkEncodeTranspiled-8 (1) 18 60042805 ns/op 76104 B/op 36 allocs/op
BenchmarkEncodeCGo1-8 (2) 31 32538122 ns/op 3213497 B/op 524294 allocs/op
BenchmarkEncodeCGo2-8 (3) 52 22482704 ns/op 26043 B/op 5 allocs/op
Expand ▾
Collapse ▴
Documentation
¶
Rendered for
linux/amd64
windows/amd64
darwin/amd64
js/wasm
Package webp implements an WEBP image decoder based on libwebp compiled to WASM.
DefaultQuality is the default quality encoding parameter.
Decode reads a WEBP image from r and returns it as an image.Image.
DecodeConfig returns the color model and dimensions of a WEBP image without decoding the entire image.
Dynamic returns error (if there was any) during opening dynamic/shared library.
Encode writes the image m to w with the given options.
type Options struct {
Quality int
Lossless bool
}
Options are the encoding parameters.
WEBP represents the possibly multiple images stored in a WEBP file.
DecodeAll reads a WEBP image from r and returns the sequential frames and timing information.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.