ESPHome 2026.9.0-dev
Loading...
Searching...
No Matches
esphome::runtime_image Namespace Reference

Data Structures

class  BmpDecoder
 Image decoder specialization for BMP images. More...
 
class  ImageDecoder
 Class to abstract decoding different image formats. More...
 
class  JpegDecoder
 Image decoder specialization for JPEG images. More...
 
class  PngDecoder
 Image decoder specialization for PNG images. More...
 
class  QoiDecoder
 Image decoder specialization for QOI images. More...
 
class  RuntimeImage
 A dynamic image that can be loaded and decoded at runtime. More...
 

Enumerations

enum  DecodeError : int { DECODE_ERROR_INVALID_TYPE = -1 , DECODE_ERROR_UNSUPPORTED_FORMAT = -2 , DECODE_ERROR_OUT_OF_MEMORY = -3 , DECODE_ERROR_INTERNAL_DECODER_ERROR = -4 }
 
enum  ImageFormat {
  AUTO , BMP , JPEG , PNG ,
  QOI
}
 Image format types that can be decoded dynamically. More...
 

Functions

constexpr const char * decode_error_to_string (int error)
 
const char * get_mime_type_for_format (ImageFormat format)
 Canonical MIME type for a format; "image/*" for AUTO/unknown.
 
std::optional< ImageFormatget_format_for_mime_type (const char *mime_type)
 Case-insensitive substring match of known media types; nullopt if none found.
 
size_t qoi_color_table_index (const Color &color)
 
bool is_color_on (const Color &color)
 

Variables

constexpr uint8_t QOI_OP_RGB = 0b11111110
 
constexpr uint8_t QOI_OP_RGBA = 0b11111111
 
constexpr uint8_t QOI_OP_INDEX = 0b00000000
 
constexpr uint8_t QOI_OP_DIFF = 0b01000000
 
constexpr uint8_t QOI_OP_LUMA = 0b10000000
 
constexpr uint8_t QOI_OP_RUN = 0b11000000
 
constexpr uint8_t QOI_RGB_CHUNK_SIZE = 4
 
constexpr uint8_t QOI_RGBA_CHUNK_SIZE = 5
 
constexpr uint8_t QOI_LUMA_CHUNK_SIZE = 2
 
constexpr uint8_t QOI_MASK_OP = 0b11000000
 
constexpr uint8_t QOI_MASK_VALUE = 0b00111111
 
constexpr size_t QOI_HEADER_SIZE = 14
 
constexpr size_t QOI_COLOR_TABLE_SIZE = 64
 

Enumeration Type Documentation

◆ DecodeError

Enumerator
DECODE_ERROR_INVALID_TYPE 
DECODE_ERROR_UNSUPPORTED_FORMAT 
DECODE_ERROR_OUT_OF_MEMORY 
DECODE_ERROR_INTERNAL_DECODER_ERROR 

Definition at line 7 of file image_decoder.h.

◆ ImageFormat

Image format types that can be decoded dynamically.

Enumerator
AUTO 

Format is supplied per decode, e.g.

detected from the Content-Type header by online_image; sniffing the image data is not implemented.

BMP 

BMP format.

JPEG 

JPEG format.

PNG 

PNG format.

QOI 

QOI format.

Definition at line 10 of file image_format.h.

Function Documentation

◆ decode_error_to_string()

const char * esphome::runtime_image::decode_error_to_string ( int error)
constexpr

Definition at line 14 of file image_decoder.h.

◆ get_format_for_mime_type()

std::optional< ImageFormat > esphome::runtime_image::get_format_for_mime_type ( const char * mime_type)

Case-insensitive substring match of known media types; nullopt if none found.

Definition at line 38 of file image_format.cpp.

◆ get_mime_type_for_format()

const char * esphome::runtime_image::get_mime_type_for_format ( ImageFormat format)

Canonical MIME type for a format; "image/*" for AUTO/unknown.

Definition at line 29 of file image_format.cpp.

◆ is_color_on()

bool esphome::runtime_image::is_color_on ( const Color & color)
inline

Definition at line 33 of file runtime_image.cpp.

◆ qoi_color_table_index()

size_t esphome::runtime_image::qoi_color_table_index ( const Color & color)
inline

Definition at line 32 of file qoi_decoder.cpp.

Variable Documentation

◆ QOI_COLOR_TABLE_SIZE

size_t esphome::runtime_image::QOI_COLOR_TABLE_SIZE = 64
constexpr

Definition at line 30 of file qoi_decoder.cpp.

◆ QOI_HEADER_SIZE

size_t esphome::runtime_image::QOI_HEADER_SIZE = 14
constexpr

Definition at line 29 of file qoi_decoder.cpp.

◆ QOI_LUMA_CHUNK_SIZE

uint8_t esphome::runtime_image::QOI_LUMA_CHUNK_SIZE = 2
constexpr

Definition at line 24 of file qoi_decoder.cpp.

◆ QOI_MASK_OP

uint8_t esphome::runtime_image::QOI_MASK_OP = 0b11000000
constexpr

Definition at line 26 of file qoi_decoder.cpp.

◆ QOI_MASK_VALUE

uint8_t esphome::runtime_image::QOI_MASK_VALUE = 0b00111111
constexpr

Definition at line 27 of file qoi_decoder.cpp.

◆ QOI_OP_DIFF

uint8_t esphome::runtime_image::QOI_OP_DIFF = 0b01000000
constexpr

Definition at line 18 of file qoi_decoder.cpp.

◆ QOI_OP_INDEX

uint8_t esphome::runtime_image::QOI_OP_INDEX = 0b00000000
constexpr

Definition at line 17 of file qoi_decoder.cpp.

◆ QOI_OP_LUMA

uint8_t esphome::runtime_image::QOI_OP_LUMA = 0b10000000
constexpr

Definition at line 19 of file qoi_decoder.cpp.

◆ QOI_OP_RGB

uint8_t esphome::runtime_image::QOI_OP_RGB = 0b11111110
constexpr

Definition at line 15 of file qoi_decoder.cpp.

◆ QOI_OP_RGBA

uint8_t esphome::runtime_image::QOI_OP_RGBA = 0b11111111
constexpr

Definition at line 16 of file qoi_decoder.cpp.

◆ QOI_OP_RUN

uint8_t esphome::runtime_image::QOI_OP_RUN = 0b11000000
constexpr

Definition at line 20 of file qoi_decoder.cpp.

◆ QOI_RGB_CHUNK_SIZE

uint8_t esphome::runtime_image::QOI_RGB_CHUNK_SIZE = 4
constexpr

Definition at line 22 of file qoi_decoder.cpp.

◆ QOI_RGBA_CHUNK_SIZE

uint8_t esphome::runtime_image::QOI_RGBA_CHUNK_SIZE = 5
constexpr

Definition at line 23 of file qoi_decoder.cpp.