Skip to content
/ smallpng Public

Small single-file Java library for writing and reading PNG files directly from and to a ByteBuffer containing RGBA pixel values

License

MIT, Unlicense licenses found

Licenses found

MIT
LICENSE-MIT
Unlicense
LICENSE-UNLICENSE
Notifications You must be signed in to change notification settings

afdw/smallpng

Repository files navigation

smallpng

This is a small (less than a thousand lines of code) single-file Java library for writing and reading PNG files directly from and to a ByteBuffer containing RGBA pixel values.

It supports everything described in the PNG standard and can automatically reduce the color depth or the images when it is possible, thus for some types of images generating smaller files than the built-in ImageIO.

API

package afdw.smallpng;

public class SmallPNG {
    public static ByteBuffer read(InputStream inputStream,
                                  AtomicInteger outWidth,
                                  AtomicInteger outHeight) throws IOException;

    public static void write(OutputStream outputStream,
                             ByteBuffer image,
                             int width,
                             int height) throws IOException;
}

Here AtomicIntegers are used as output parameters.

License

This project is licensed under either of

at your option.

About

Small single-file Java library for writing and reading PNG files directly from and to a ByteBuffer containing RGBA pixel values

Resources

License

MIT, Unlicense licenses found

Licenses found

MIT
LICENSE-MIT
Unlicense
LICENSE-UNLICENSE

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages