#png #pixelart #image #plte


Fast, pixelated, palette-based PNG renderer

1 unstable release

0.1.0 Apr 4, 2019

#9 in #image-encoding

Download history 10/week @ 2022-11-27 18/week @ 2022-12-04 20/week @ 2022-12-11 19/week @ 2022-12-18 12/week @ 2022-12-25 7/week @ 2023-01-01 16/week @ 2023-01-08 8/week @ 2023-01-15 30/week @ 2023-01-22 31/week @ 2023-01-29 20/week @ 2023-02-05 9/week @ 2023-02-12 26/week @ 2023-02-19 29/week @ 2023-03-05 6/week @ 2023-03-12

63 downloads per month
Used in blockies

GPL-3.0 license

109 lines


This logo is rendered with this crate

It's only 861 bytes for a 720x128 image. Check out the code.

Why is this even a thing?!

Rendering up-scaled pixelated PNG files can be quite useful for things like:

  • QR codes.
  • Identicons like Blockies.
  • Pixel Art?

Usually a PNG image data, before compression, is a bitmap that packs 3 or 4 bytes per pixel, depending whether transparency is present or not. For all of the cases above this is way more information than necessary.

PNG supports an indexed palette format. Using the indexing palette makes it possible not only to pack a single pixel into a single byte, but for small palettes a pixel can be 4, 2, or even just 1 bit. The logo here is using 3 colors (black, transparent background and shadow), which allows Pixelate to produce a bitmap where each pixel takes only 2 bits.

Not only does this produce smaller images after compression, smaller bitmap is also much faster to compress, as much as 10x for small palettes. This makes it ideal for rendering QR codes or identicons on the fly.


Ramhorns is free software, and is released under the terms of the GNU General Public License version 3. See LICENSE.


~12K SLoC