Skip to content

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

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages