All Projects â†’ AldaronLau â†’ png_pong

AldaronLau / png_pong

Licence: Apache-2.0, Zlib licenses found Licenses found Apache-2.0 LICENSE-APACHE Zlib LICENSE-ZLIB
A pure Rust PNG image decoder and encoder based on lodepng.

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to png pong

png
🖞A full-featured PNG decoder and encoder.
Stars: ✭ 64 (+204.76%)
Mutual labels:  png, encoder, decoder
Bbwebimage
A high performance Swift library for downloading, caching and editing web images asynchronously.
Stars: ✭ 128 (+509.52%)
Mutual labels:  png, encoder, decoder
nimPNG
PNG (Portable Network Graphics) decoder and encoder written in Nim
Stars: ✭ 81 (+285.71%)
Mutual labels:  png, png-decoder, png-encoder
Enmime
MIME mail encoding and decoding package for Go
Stars: ✭ 246 (+1071.43%)
Mutual labels:  encoder, decoder
Codable Diy Kit
A template for creating your own Swift Codable encoders and decoders
Stars: ✭ 207 (+885.71%)
Mutual labels:  encoder, decoder
Codablecsv
Read and write CSV files row-by-row or through Swift's Codable interface.
Stars: ✭ 214 (+919.05%)
Mutual labels:  encoder, decoder
pnglib-es6
Create png images in pure javascript (modern & fast ES6 version using typed Arrays)
Stars: ✭ 41 (+95.24%)
Mutual labels:  png, png-encoder
glitch-studio
data bending & glitch tools
Stars: ✭ 66 (+214.29%)
Mutual labels:  png, png-decoder
zigimg
Zig library for reading and writing different image formats
Stars: ✭ 112 (+433.33%)
Mutual labels:  png, png-decoder
rmarsh
Ruby Marshal 4.8 encoder/decoder in Golang. Why? Who knows.
Stars: ✭ 15 (-28.57%)
Mutual labels:  encoder, decoder
BatchEncoder
BatchEncoder is an audio files conversion software.
Stars: ✭ 145 (+590.48%)
Mutual labels:  encoder, decoder
sms
A Go library for encoding and decoding SMSs
Stars: ✭ 37 (+76.19%)
Mutual labels:  encoder, decoder
Xmlschema
XML Schema validator and data conversion library for Python
Stars: ✭ 201 (+857.14%)
Mutual labels:  encoder, decoder
Ks265codec
ks cloud hevc(h265) encoder decoder test and description
Stars: ✭ 192 (+814.29%)
Mutual labels:  encoder, decoder
Gojay
fastest JSON encoder/decoder with powerful stream API for Golang
Stars: ✭ 2,009 (+9466.67%)
Mutual labels:  encoder, decoder
Ffmediatoolkit
FFMediaToolkit is a cross-platform video decoder/encoder library for .NET that uses FFmpeg native libraries. It supports video frames extraction, reading stream metadata and creating videos from bitmaps in any format supported by FFmpeg.
Stars: ✭ 156 (+642.86%)
Mutual labels:  encoder, decoder
Base62
Base62 encoder and decoder for arbitrary data
Stars: ✭ 141 (+571.43%)
Mutual labels:  encoder, decoder
Salsanext
Uncertainty-aware Semantic Segmentation of LiDAR Point Clouds for Autonomous Driving
Stars: ✭ 153 (+628.57%)
Mutual labels:  encoder, decoder
logfmt
Package logfmt marshals and unmarshals logfmt messages.
Stars: ✭ 156 (+642.86%)
Mutual labels:  encoder, decoder
urlpack
Pure JavaScript toolkit for data URLs (MessagePack, Base58 and Base62)
Stars: ✭ 51 (+142.86%)
Mutual labels:  encoder, decoder

PNG Pong

A pure Rust PNG/APNG encoder & decoder

tests docs crates.io

This is a pure Rust PNG image decoder and encoder taking inspiration from lodepng. This crate allows easy reading and writing of PNG files without any system dependencies.

Why another PNG crate?

These are the 4 Rust PNG encoder/decoder crates I know of:

  • png - The one everyone uses (used to be able to load less pngs than png_pong and slower, but has caught up).
  • lodepng - Loads all the PNGs, code is ported from C, therefore code is hard read & maintain, also uses slow implementation of deflate/inflate algorithm.
  • imagefmt - Abandoned, and limited in what files it can open, but with a lot less lines of code.
  • imagine - PNG decoding only.

Originally I made the aci_png based on imagefmt, and intended to add more features. At the time, I didn't want to write a PNG encoder/decoder from scratch so I decided to take lodepng which has more features (and more low level features) and clean up the code, upgrade to 2018 edition of Rust, depend on the miniz_oxide crate (because it can decompress faster than lodepng's INFLATE implementation) and get rid of the libc dependency so it actually becomes pure Rust (lodepng claims to be, but calls C's malloc and free). Then, I rewrote the entire library, based on gift and pix.

Goals

  • Forbid unsafe.
  • APNG support as iterator.
  • Fast.
  • Compatible with pix / gift-style API.
  • Load all PNG files crushed with pngcrush.
  • Save crushed PNG files.
  • Clean, well-documented, concise code.
  • Implement all completed, non-deprecated chunks in the PNG 1.2 Specification, including the PNG 1.2 Extensions and the APNG Specification

TODO

  • Implement APNG reading.
  • Implement Chunk reading (with all the different chunk structs).
  • StepDecoder should wrap StepDecoder, RasterEncoder should wrap ChunkEncoder
  • More test cases to test against.

Benchmarks And Comparisons

Using Rust 1.52.1, criterion and 4 different PNG sizes with PNGs from "./tests/png/" (units are: us / microseconds). I stopped anything that was predicted to take longer than a half hour with criterion with the message "TIMEOUT".

  • sRGB 1x1: Uses tests/png/profile.png
  • sRGBA 1x1: Uses tests/png/test.png
  • sRGB 64x64: Uses test/png/4.png
  • sRGBA 64x64: Uses tests/png/res.png
  • sRGB 256x256: tests/png/PngSuite.png
  • sRGBA 256x256: Uses tests/png/icon.png
  • sRGB 4096x4096: tests/png/plopgrizzly.png
  • sRGBA 4096x4096: Uses tests/png/noise.png

Encoder

Library sRGB 1x1 sRGBA 1x1 sRGB 64x64 sRGBA 64x64 sRGB 256x256 sRGBA 256x256 sRGB 4096x4096 sRGBA 4096x4096
png_pong 41.956 8.2661 1_025.7 700.80 2_646.1 5_061.5 587_320 3_587_100
png 29.538 9.4122 213.49 203.02 944.99 1_534.3 201_680 1_535_300
lodepng 59.989 10.700 1_399.3 982.63 3_391.3 6_664.7 831_190 3_394_900
imagefmt 8.7942 8.7399 211.01 177.82 901.22 1_569.4 218_550 1_285_700
imagine --- --- --- --- --- --- --- ---
aci_png FAILS 30.987 FAILS 289.24 FAILS 2_298.1 FAILS 2_135_400
libpng-sys 6.8443 2.9461 1_613.5 769.70 2_261.1 4_745.2 520_770 2_926_900

Decoder

Library sRGB 1x1 sRGBA 1x1 sRGB 64x64 sRGBA 64x64 sRGB 256x256 sRGBA 256x256 sRGB 4096x4096 sRGBA 4096x4096
png_pong 7.7520 3.9459 77.981 99.384 752.95 901.98 178_880 570_200
png 8.1195 6.6107 54.834 71.873 643.09 686.29 128_000 355_080
lodepng 5.8958 5.4527 77.050 97.762 882.83 982.76 230_570 563_210
imagefmt 4.2864 4.8706 74.715 82.026 566.86 758.27 69_465 545_060
imagine 2.8809 0.44822 3_202.3 2_266.4 2_056.1 10_753 442_750 27_944_000
aci_png 5.0243 4.3516 201.29 174.30 1_500.6 1_689.8 398_340 1_323_600
libpng-sys 3.6011 0.48747 1.8175 0.67344 25.809 4.4175 19_400 18_262

Table of Contents

API

API documentation can be found on docs.rs.

Features

There are no optional features.

Upgrade

You can use the changelog to facilitate upgrading this crate as a dependency.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Before contributing, check out the contribution guidelines, and, as always, make sure to always follow the code of conduct.

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].