PNG libraries
Open-source libraries that decode and encode PNG files. Most languages have PNG support in the standard library or in one dominant image library; pick a dedicated PNG library when you need PNG-specific control (text chunks, bit depth, palettes, APNG frames, streaming row by row).
| Language | Library | Read | Write | Notes |
|---|---|---|---|---|
| C/C++ | libpng | yes | yes | reference implementation, every PNG feature |
| C/C++ | libspng | yes | yes | simpler and faster libpng alternative |
| C/C++ | LodePNG | yes | yes | single file, no dependencies (has its own zlib) |
| C/C++ | stb_image | yes | yes | single header, public domain, many formats |
| C# | ImageSharp | yes | yes | pure managed code, cross-platform |
| C# | SkiaSharp | yes | yes | wrapper of Google’s Skia, fast drawing |
| C# | Magick.NET | yes | yes | ImageMagick for .NET, 100+ formats |
| Java | ImageIO | yes | yes | built into the JDK |
| Java | PNGJ | yes | yes | row by row, low memory, full chunk access |
| Go | image/png | yes | yes | standard library |
| Go | imaging | yes | yes | resize, crop, rotate on top of image/png |
| Python | Pillow | yes | yes | the standard Python imaging library |
| Python | pypng | yes | yes | pure Python, all bit depths |
| Python | OpenCV | yes | yes | images as NumPy arrays |
| Ruby | ChunkyPNG | yes | yes | pure Ruby |
| Ruby | ruby-vips | yes | yes | fast, low memory, libvips binding |
| Ruby | MiniMagick | yes | yes | wraps ImageMagick command line |
| Rust | png | yes | yes | pure Rust, used by the image crate |
| Rust | image | yes | yes | high-level, many formats |
| PHP | GD | yes | yes | bundled with PHP |
| PHP | Imagick | yes | yes | ImageMagick extension |
| PHP | Intervention Image | yes | yes | fluent API over GD or Imagick |
By language#
- PNG libraries for C/C++ Open-source C/C++ libraries to read and write PNG images: libpng, libspng, LodePNG and stb_image. Comparison and code examples.
- PNG libraries for C# Open-source C# libraries to read and write PNG images: ImageSharp, SkiaSharp and Magick.NET. Comparison and code examples.
- PNG libraries for Java Open-source Java libraries to read and write PNG images: ImageIO, PNGJ. Comparison and code examples.
- PNG libraries for Go Open-source Go libraries to read and write PNG images: image/png and imaging. Comparison and code examples.
- PNG libraries for Python Open-source Python libraries to read and write PNG images: Pillow, pypng and OpenCV. Comparison and code examples.
- PNG libraries for Ruby Open-source Ruby libraries to read and write PNG images: ChunkyPNG, ruby-vips and MiniMagick. Comparison and code examples.
- PNG libraries for Rust Open-source Rust libraries to read and write PNG images: the png and image crates. Comparison and code examples.
- PNG libraries for PHP Open-source PHP libraries to read and write PNG images: GD, Imagick and Intervention Image. Comparison and code examples.