Features

Decodes any image that the PNG standard allows. This includes all standard
color modes with different bit depths and all transparency, interlacing and
filtering options.

Encodes images supports all color modes (true color, grayscale and indexed)
and transparency for all these color modes. The best color mode will be
chosen automatically, based on the image’s colors.

R/W access to the image’s pixels.

R/W access to all image metadata that is stored in chunks.

Alpha composition of different images.

Memory efficient (uses a Fixnum, i.e. 4 or 8 bytes of memory per pixel,
depending on the machine)

Reasonably fast for Ruby standards, by only using
integer math and a optimized encoding routine. If the performance is not
enough have a look at OilyPNG (see github.com/wvanbergen/oily_png),
a mixin module that replaces the slowest routines with a C-based
implementation.

Using raw RGB(A) streams

Decoding PNG files is slow. If you can control the input data, consider
supplying the pixel data as an RGBA or RGB formatted stream, in which all
pixels are encoded from left to right, top to bottom, using 1 byte per
channel:

Saving image data

Encoding options

ChunkyPNG tries to detect the optimal encoding parameters when saving an
image. The detection costs some time, and it may choose a slow encoding
method. To override the detection mechanism, and always save as RGB or RGBA
image, use the @:fast_rgba@ or @:fast_rgb@ modifier when calling save:

After you have submitted a patch that convinces me that you understand the
internals of the library, I can add you as a collaborator to the project if
you wish.

More information

This library is MIT licensed and tested with Ruby 1.8.7, 1.9.3, 2.0.0 and
Ruby 2.1.1, which is highly recommended because of performance gains.
Because it is pure Ruby, it will also work on other Ruby implementations
like JRuby and Rubinius.