• Stars
    star
    221
  • Rank 179,773 (Top 4 %)
  • Language
    C
  • License
    Other
  • Created almost 9 years ago
  • Updated about 1 year ago

Reviews

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

Repository Details

A JPEG decoder library

Arduino JPEGDecoder library

News: October 2019 - I have created a new Arduino compatible Jpeg decoder library here. This new library is based on TinyJpegDec, this is 60% faster on 32bit processors, it also has a much simpler interface.

This Arduino library supports the rendering of Jpeg files stored both on SD card and in arrays within program memory (FLASH) onto a TFT display. In addition images stored in the SPIFFS (or LittleFS) Flash filing system or "PROGMEM" arrays can be used with the ESP8266 and ESP32 processors. For the ESP8266 use board Core 2.3.0 (or later) in the Arduino IDE to avoid File definition conflicts if the SPIFFS and SD libraries are used together.

The library works on the Arduino Due, ESP32 and ESP8266 (e.g. NodeMCU 1.0). Users have also reported success with the STM32 based processor boards.

Example images can be found in the "extras" folder.

Jpeg files must be in 24bit format (8 bit not supported). Jpeg files in the "Progressive" format (where image data is compressed in multiple passes with progressively higher detail) are not supported either since this would require much more memory.

High Jpeg compression ratios work best on images with smooth colour changes, however the Baboon40.jpg image at only 23.8 KBytes renders quite nicely. Typically a 480x320 image can be compressed without much degradation to less than 32 KBytes, in comparison a 24 bit BMP image would occupy 461 KBytes! For comaprison the 480 x 320 Mouse480 image has been to compressed to a mere 6.45 Kbytes!

When storing the jpeg in a memory array bear in mind the Arduino AVR processors (e.g. Mega2560 and Xmega) have a maximum 32767 byte limit for the maximum size of an array (32 KBytes minus 1 byte).

The decompression of Jpeg images needs more RAM than an UNO provides, thus this library is targetted at processors with more RAM. The library has been tested with Arduino Due and ESP8266/ESP32 based boards.

The decompression of Jpegs involves a lot of maths, so it takes a Due about ~1.3s to render a fullscreen (480x320 pixel) image and the Mega will take ~5s to do the same. The time for smaller images will reduce roughly pro-rata with the total pixel count. An ESP8266 running at 160MHz and 40MHz SPI coupled to a 320x240 ILI9341 display can render a Jpeg in as little as 240ms.

This library supports either the SD library (and SdFat for Due). The SdFat allows a bit-bashed SPI interface to an SD Card which can be convenient for example on pins 50, 51 and 52 of a Due (on Mega these are hardware SPI).

The library has been tested with the 1.8.1 version of the Arduino IDE and may generate error messages at compile time on other versions because "#ifdef __AVR__" is used to distinguish between the Mega and Due and select the correct libraries.

The library has been tested with 3.2" and 3.0" displays based on the HX8357B, HX8357C and ILI9481 driver chips with a 16 bit parallel interface. Adapting the example sketch for other TFT drivers and their graphics libraries should be quite easy if they support either setWindow() or SetAddrWindow() and pushColor() functions as found in the Adafruit_GFX library.

The Arduino Mega is not recommended as it does not reliably decode some jpeg images possibly due to a shortage of RAM. The Due will work fine with much bigger image sets in FLASH.

The ESP8266 and ESP32 has been tested with an ILI9341 library using the SPI interface, with Jpeg images stored in SPIFFS and in Flash arrays.

SD and SPIFFS filenames can be in String or character array format. File handles can also be used.

This library has been based on the excellent picojpeg code and the Arduino library port by Makoto Kurauchi here: https://github.com/MakotoKurauchi/JPEGDecoder

Makoto's original Readme below:

JPEG Decoder for Arduino

概要

Arduino 用 JPEG デコーダです。デコーダ部には picojpeg を使用しています。

サンプルコード

###SerialCsvOut

SD カード上の JPEG ファイルをブロックごとにデコードし、シリアルから CSV を出力します。

変更履歴

V0.01 - 最初のリリース

More Repositories

1

TFT_eSPI

Arduino and PlatformIO IDE compatible TFT library optimised for the Raspberry Pi Pico (RP2040), STM32, ESP8266 and ESP32 that supports different driver chips
C
3,582
star
2

TJpg_Decoder

Jpeg decoder library based on Tiny JPEG Decompressor
C
223
star
3

TFT_HX8357

Arduino library for HX8357 TFT display
C
117
star
4

TFT_ILI9341

A fast Arduino IDE compatible graphics and fonts library including a driver for the ILI9341 based TFT displays.
C
109
star
5

TFT_eWidget

A TFT support GUI library providing button, graph, meter, and slider class functions.
C++
90
star
6

TFT_eFEX

A support library for TFT_eSPI that adds commonly used extra functions
C++
83
star
7

DarkSkyWeather

Arduino ESP32 and ESP8266 compatible library to read weather forecast from Dark Sky API
C++
80
star
8

TFT_ST7735

Arduino graphics library for ST7735 displays with propotional fonts
C
78
star
9

EPD_Libraries

A set of adapted Arduino libraries for Waveshare ePaper displays for ESP8266 and ESP32
C
49
star
10

U8g2_for_TFT_eSPI

C
40
star
11

OpenWeather

Arduino library to fetch weather information from OpenWeather
C++
38
star
12

JSON_Decoder

Streaming parser for decoding JSON streams on small devices
C++
32
star
13

TFT_Touch

Arduino touch screen library for XPT2046
C++
29
star
14

TFT_ILI9341_ESP

TFT ILI9341 library for ESP8266 and NodeMCU
C
29
star
15

TFT_HX8357_Due

Arduino Due TFT diaplay library for 16bit HX8357B/C and ILI9481 drivers
C
26
star
16

User_Manual_TFT_eSPI

User Manual for TFT_eSPI
25
star
17

Audio-Spectrum-FFT

Arduino sketch to sample PDM microphone and show frequencies using FFT
C++
20
star
18

TFT_ILI9163

Arduino library for ILI9163 based TFT displays
C
19
star
19

TFT_eFX

An example graphics extension library for TFT_eSPI
C++
18
star
20

ESP8266_uncannyEyes

A port of the Adafruit uncannyEyes to the NodeMCU and ILI9341 display
C
11
star
21

PowerPoint_to_sketch

Create an Arduino Sketch from a PowerPoint presentation
C++
10
star
22

TFT_SdFat

A tweaked version of SdFat to improve block read speed
C++
10
star
23

ADC_DMA_FFT

RP2040: sample ADC, run FFT, display on TFT
C++
10
star
24

SdFat

A version of SdFat that works with the JPEGDecoder library
C++
8
star
25

PNG_TEST_ONLY

Work in progress PNG decoder test sketches
C
8
star
26

TFT_S6D02A1

A fast Arduino TFT library for S6D02A1 based displays
C
7
star
27

Pico_Unicorn_GFX

Arduino library for Raspberry Pico with Pimoroni Unicorn 7x16 LED display
C++
7
star
28

ApixuWeather

Arduino ESP32 and ESP8266 compatible library to read weather forecast from Apixu API
C++
7
star
29

Touch_FT5x06

Multi-touch Arduino library for Focaltech FT5x06 capacitive touch controller
C++
5
star
30

GFX_Font_Converter

Windows executable to create GFX compatible fonts from ttf format font files
5
star
31

Raspberry-Pico_Micropython_Scripts

A collection of Micropython scripts for the Raspberry Pico
Python
4
star
32

TFT_eButton

TFT button library for TFT_eSPI
C++
4
star
33

Interrupt_driven_stepper

Arduino sketch to drive a stepper motor using Timer 1 interrupts
C++
3
star
34

MCUFRIEND_kbv-screenshot-server-and-client-sketch

Arduino MCUFRIEND_kbv TFT screenshot capture utility
C
2
star
35

Github-images

Images for use in ReadMe
1
star