diff options
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -3,7 +3,7 @@ [crates.io page](https://crates.io/crates/minipng) · [repository](https://github.com/pommicket/minipng) Tiny Rust PNG decoder with no dependencies (not even `std` or `alloc`) -and tiny code size (e.g. >8 times smaller `.wasm.gz` size compared to the `png` crate — see `check-size.sh`). +and tiny code size (e.g. ~9 times smaller `.wasm.gz` size compared to the `png` crate). ## Goals @@ -30,7 +30,7 @@ Basic usage: ```rust let mut buffer = vec![0; 1 << 20]; // hope this is big enough! -let png = &include_bytes!("../examples/image.png")[..]; +let png = &include_bytes!("examples/image.png")[..]; let image = minipng::decode_png(png, &mut buffer).expect("bad PNG"); println!("{}×{} image", image.width(), image.height()); let pixels = image.pixels(); @@ -41,7 +41,7 @@ println!("top-left pixel is #{:02x}{:02x}{:02x}", pixels[0], pixels[1], pixels[2 More complex example that allocates the right number of bytes and handles all color formats: ```rust -let png = &include_bytes!("../examples/image.png")[..]; +let png = &include_bytes!("examples/image.png")[..]; let header = minipng::decode_png_header(png).expect("bad PNG"); let mut buffer = vec![0; header.required_bytes_rgba8bpc()]; let mut image = minipng::decode_png(png, &mut buffer).expect("bad PNG"); @@ -72,8 +72,8 @@ tests and no way of enabling `--nocapture` by default *grumble grumble*). ## Performance -Benchmarks (see `cargo bench`) show that `minipng` is about 50% slower than the `png` crate -for large images, but faster than `png` for small images. +Benchmarks (see `cargo bench`) show that `minipng` is about 2× slower than the `png` crate +for large images, but about the same for small images. ## License |