• Stars
    star
    180
  • Rank 213,097 (Top 5 %)
  • Language
    C
  • License
    Apache License 2.0
  • Created over 3 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An optimized PNG decoder suitable for microcontrollers and PCs

PNGdec

Copyright (c) 2021 BitBank Software, Inc.
Written by Larry Bank
[email protected]

What is it?

An 'embedded-friendly' (aka Arduino) PNG image decoding library

Why did you write it?

Starting in the late 80's I wrote my own imaging codecs for the existing standards (CCITT G3/G4 was the first). I soon added GIF, JPEG and not long after that, the PNG specification was ratified. All of this code was "clean room" - written just from the specification. I used my imaging library in many projects and products over the years and recently decided that some of my codecs could get a new lease on life as open source, embedded-friendly libraries for microcontrollers.

What's special about it?

The PNG image specification was written at a time when computers had megabytes of RAM and conserving memory wasn't a big priority. The memory allocated for decoding the compressed data (zlib) and for holding the uncompressed image can be quite a bit more than is available on modern microcontrollers (usually measured in K bytes). Three goals for this project are: easy to compile+use on all embedded systems, use a minimal amount of RAM and be self-contained. One of the dependencies I like to remove when working on embedded software is malloc/free. When compiling on a system with a tiny amount of RAM, heap memory management might not even exist.

Feature summary:
----------------

  • Runs on any MCU with at least 48K of free RAM
  • No external dependencies (including malloc/free)
  • Decode an image line by line with a callback function
  • Decode an image to a user supplied buffer (no callback needed)
  • Supports all standard options except interlacing (too much RAM needed)
  • Function provided to turn any pixel format into RGB565 for LCD displays
  • Optionally disable zlib's internal CRC check - improves speed by 10-30%
  • Arduino-style C++ library class with simple API
  • Can by built as straight C as well

How fast is it?
---------------
The examples folder contains a sketch to measure the performance of decoding a 240x200 image of varying bit depths. Here's the results when run on a few common MCUs:


Documentation:
---------------
Detailed information about the API is in the Wiki
See the examples folder for easy starting points

More Repositories

1

JPEGDEC

An optimized JPEG decoder suitable for microcontrollers and PCs.
C
399
star
2

Thermal_Printer

Arduino library to draw text and graphics on BLE thermal printers
C
373
star
3

AnimatedGIF

An optimized GIF decoder suitable for microcontrollers and PCs
C
363
star
4

BitBang_I2C

A software I2C implementation to run on any GPIO pins on any system
C++
240
star
5

image_to_c

Convert image files into C arrays of uint8_t for compiling into your project
C
198
star
6

OneBitDisplay

A full featured Arduino display library for 1-bit per pixel OLED, LCD and e-paper displays
C
195
star
7

ss_oled

Simple and small library to control 1-bpp OLED displays (Linux + Arduino)
C++
188
star
8

SPI_LCD

A simple C library for directly communicating with SPI-connected LCD displays
C
112
star
9

bb_spi_lcd

SPI LCD/OLED library which can be built for Arduino and Linux
C++
91
star
10

SmartResponseXE

Arduino library with LCD, Keyboard and SPI Flash support for the SMART Response XE classroom communicator
C++
89
star
11

SLIC

Simple lossless imaging codec
C++
80
star
12

oled_96

A simple C library (Linux + Arduino) for drawing text and graphics on SSD1306/SH1106 OLED displays
C
79
star
13

ArmbianIO

A C (+ Python and Java) library for simplifying access to I2C, SPI and GPIO on boards supported by Armbian
C
78
star
14

Multi_OLED

Control multiple OLED displays on one or more I2C buses simultaneously
C++
76
star
15

Print2BLE

MacOS app which allows drag and drop of images to BLE thermal printers
Objective-C
72
star
16

CYD_Projects

A collection of Arduino sketches for the "Cheap Yellow Display" board(s)
C
58
star
17

JPEGENC

Arduino JPEG encoder
C++
55
star
18

VL53L0X

A simple C library to read the distance values from the VL53L0X time of flight sensor
C
54
star
19

unzipLIB

An embedded-friendly library for decompressing files from zip archives
C
51
star
20

oled_turbo

An experiment to push the limits of the SSD1306 through bit banging on Arduinos
C++
45
star
21

PNGenc

An embedded-friendly PNG encoder
C
39
star
22

Multi_BitBang

A software I2C implementation to create multiple I2C buses using GPIO lines
C++
38
star
23

giflib-turbo

A faster drop-in replacement for giflib. It uses more RAM, but you get more speed.
C
37
star
24

SMART_bootloader

Send sketches wirelessly from the Arduino IDE to your SMART Response XE
C
35
star
25

BB-CP

A faster replacement for FBTFT + FBCP
C
31
star
26

LCD1602

A C library (Linux + Arduino) to control 2 line x 16 character I2C LCD displays
C
28
star
27

ssd1327

SSD1327 and SSD1322 OLED display library for Arduino+Linux
C++
26
star
28

oled_animator

C code for converting animated GIF images into a form to run on MCUs and SSD1306 OLED displays
C
26
star
29

Pocket_CO2

A CH32V003 low cost pocket CO2 sensor
C
24
star
30

BLE_Keyboard

An HID keyboard sketch for the Arduino Nano 33 BLE
C++
23
star
31

TIFF_G4

A set of highly optimized functions for decoding and displaying 1-bpp CCITT G4 images
C
22
star
32

I2C_Detector

Scan I2C buses and identify devices which respond.
C++
22
star
33

MAX7219

A C library for controlling any number of Maxim LED matrix controllers
C
21
star
34

bb_captouch

An ESP32/Arduino library to talk to CST820, FT6x36 and GT911 capacitive touch sensors (auto-detects)
C++
21
star
35

Pi_Pico_C_Projects

A collection of C code for the Raspberry Pi Pico
C
20
star
36

uc1701

A C library (Linux + Arduino) to control the UC1701/ST7565/ST7920 128x64 monochrome LCD
C
20
star
37

sg_free

The open source version of SmartGear - a multi-system game emulator
C
19
star
38

epd_image

Prepare image data for writing directly to e-paper displays
C++
18
star
39

bbgfx

BitBank Graphics Library - optimized primitives for RGB565 surfaces on ARMv5
C
17
star
40

Nano_33_Gamepad

A sketch to connect BLE HID gamepads to the Arduino Nano 33 BLE
C++
15
star
41

sense_hat_unchained

A C library to work with the Sense Hat on non-RPI hardware
C
15
star
42

tm1637

A C library for controlling Titan Micro Electronic's 7-segment LED controller
C
13
star
43

esp32_gamepad

Arduino library to connect a SteelSeries:Free gamepad to your ESP32 microcontroller
C++
13
star
44

BLE_2_EPaper

A collection of projects to send images over BLE to e-paper displays
C
12
star
45

KiCad_Projects

A place to share all of my PCB projects
12
star
46

gcc_perf

Test ARM/X86 C/SIMD/ASM perf on 32-bit and 64-bit Linux to see machine/compiler differences
C
12
star
47

bb_truetype

An incomplete, but fast + useful truetype font renderer for embedded devices
C++
11
star
48

Animated_Sand

Arduino demo for SSD1306 I2C display + MPU-6050 accelerometer.
C++
11
star
49

G4Enc

Optimized CCITT G4 encoder for embedded and larger systems
C++
10
star
50

FastIO

A fast substitute for Arduino digital pin functions on AVR MCUs
C++
10
star
51

bin_to_c

A simple Linux command line tool for turning binary files into C source code (array of unsigned chars)
C
9
star
52

gif_play

Play animated GIF images directly on a Linux framebuffer or SPI LCD
C
9
star
53

ESP_NOW_Weather

An e-paper weather project which uses a client/server approach to save battery life
C
9
star
54

bb_epaper

A frustration-free library for working with all 24-pin eink panels
C
8
star
55

NeoPixel

A simple NeoPixel (WS2812B) sketch for generating long light patterns with low RAM usage
C++
8
star
56

TwoBitDisplay

An Arduino library to control 2-bit (4 gray level) LCD displays
C++
8
star
57

RemoteDisplay

An Arduino library to control local or remote (BLE/I2C/UART/WiFi) displays with optional button input
C++
8
star
58

CH32V_Experiments

A place to share code and projects related to the WCH CH32V RISC-V processors
C
8
star
59

CCS811

A simple C library for working with the CCS811 air quality sensor
C
8
star
60

ESLImageTransfer

An Android native app to transfer images to the hacked ESLs
Java
7
star
61

gnu_asm

A C command line tool to convert Microsoft ASM files to GAS (GNU assembler) format
C
7
star
62

hx1230

A C library (Linux + Arduino) to control hx1230 monochrome LCDs
C++
7
star
63

bme280

A simple C library (Linux + Arduino) to read the calibrated temperature/pressure/humidity values from a Bosch BME280 I2C sensor
C
6
star
64

CH32V003_Sensor_Platform

Firmware for a small PCB with LCD which allows easy plug-n-play field-testing of some I2C sensors
C
6
star
65

zlib_turbo

Optimized zlib inflate (+gzip) library for embedded
C++
6
star
66

SmartGear_ESP32

multi-game emulator for the ESP32
C++
5
star
67

ir_receiver

C code to receive NEC codes from a GPIO connected to a IR demodulator
C
5
star
68

LED_Clock

A low cost PCB project (w/firmware) for a dark-room-friendly digital clock
C
5
star
69

CH32V_Color_LCD

A set of functions to control Sitronix color LCDs on CH32V RISC-V MCUs
C
5
star
70

rtc_eeprom

C code to talk to the DS3231 and AT24C32 (usually sold together)
C++
5
star
71

zeemouse

Use 'undocumented' bluetooth game controllers to control your mouse and/or generate keypresses from buttons and stick movements
C
5
star
72

bb_uc1701

Arduino ST7565/UC1701 128x64 LCD display library
C++
5
star
73

CO2_USB_033

A portable CO2 monitor based on the CH32X033 MCU
C
5
star
74

W600FastIO

Optimized GPIO pin functions for the WinnerMicro W600 SoC
C++
4
star
75

arduinoVNC

A VNC client for Arduino
C++
4
star
76

max44009

A simple C library to initialize and read the ambient light value
C
3
star
77

bb_rtc

An Arduino RealTime Clock library which auto-detects DS3231, RV-3032 and PCF8563
C++
3
star
78

oled_sprites

A sprite and tile system for the ATtiny85 & SSD1306 (or more powerful MCU)
C++
3
star
79

imageinfo

A lightweight (aka fast) tool for identifying and displaying the relevant info for image files.
C
3
star
80

accelerometers

A C library to read the accelerometer and gyroscope values from a collection of popular sensors
C
3
star
81

nokia5110

A simple C library (Linux + Arduino) to talk to Nokia 5110 LCD displays
C
3
star
82

nrf24_test_rig

An Arduino sketch for nRF24 range testing using a Pro Mini, 64x32 OLED and 2 buttons
C++
3
star
83

Nano_33_BeetleC

Control the M5Stack Beetle-C car over BLE with an Arduino Nano 33 BLE
C++
3
star
84

weather_mon

A sample weather monitoring program which records the output to a CSV file
C
3
star
85

galactic_unicorn_test

A simple Arduino project to display time + temp + humidity + CO2
C++
3
star
86

rtc_setter

An Arduino sketch to set the local time (corrected for DST) to your DS3231 RTC
C++
3
star
87

bb_hx1230

Arduino library to control HX1230 / STE2007 96x68 LCD displays
C++
3
star
88

FT6236G

An Arduino library for FocalTech FT6x36 capacitive touch controllers
C++
3
star
89

ISBIC

Incredibly Simple Bitonal Image Compression
C
3
star
90

Fusion_360_Projects

A place to share 3D projects
3
star
91

bb_temperature

A multi-device temperature/humidity/pressure sensor library with auto-detection.
C++
3
star
92

bb_scd41

Sensiron SCD4x Arduino library
C++
2
star
93

framebuffer

Experiments with using the Linux framebuffer directly (mostly on Raspberry Pi)
C
2
star
94

min_search_arm

Arm NEON demo to search an unsorted list of integers for the minimum value
C
2
star
95

NXP_Test

Experimental code for the OKDO E1 (NXP LPC55S69)
C
2
star
96

bb_ltr390

visible/UV light sensor Arduino library
C++
2
star
97

armbian_oled

A C library for SSD1306 displays (I2C+SPI) which uses my ArmbianIO library
C
2
star
98

pi_car

A bluetooth gamepad controlled 4wd car with a Rasberry Pi Zero as its brain
C
1
star
99

oled_example

Sample code to talk to a SSD1306 OLED display utilizing my oled_96 library
C
1
star
100

bb-hole

A DNS black hole for filtering out ads/dangerous sites
C
1
star