img_format_t

Updated: May 06, 2022

Image formats

Synopsis:

#include <img/img.h>

typedef enum {
   ...
} img_format_t;

Description:

The img_format_t is an enumeration of these possible image formats:

IMG_FMT_INVALID
Invalid image format
IMG_FMT_MONO
Monochromatic bitmap with 1 bit/pixel, packing 8 pixels per byte.
IMG_FMT_G8
8-bits/pixel graymap.
IMG_FMT_PAL1
1-bit/pixel index into a palette of 2 entries, packing 8 pixels per byte.
IMG_FMT_PAL4
4-bits/pixel index into a palette of up to 16 entries, packing 2 pixels per byte.
IMG_FMT_PAL8
8-bits/pixel index into a palette of up to 256 entries.
IMG_FMT_PKLE_RGB565
16-bits/pixel RGB packed into 16-bit little-endian integer type with bits 0-4 for B, 5-10 for G, and 11-15 for R.
IMG_FMT_PKBE_RGB565
A big-endian version of IMG_FMT_PKLE_RGB565
IMG_FMT_PKLE_ARGB1555
16-bits/pixel ARGB packed into 16-bit little-endian integer type with bits 0-4 for B, 5-9 for G, 10-14 for R and most significant bit for A.
IMG_FMT_PKBE_ARGB1555
A big-endian version of IMG_FMT_PKLE_ARGB1555
IMG_FMT_BGR888
24-bits/pixel BGR with 8 bits per channel as an ordered byte sequence.
IMG_FMT_RGB888
24-bits/pixel RGB with 8 bits per channel as an ordered byte sequence.
IMG_FMT_RGBA8888
32-bits/pixel RGBA with 8 bits per channel as an ordered byte sequence.
IMG_FMT_PKLE_ARGB8888
32-bits/pixel ARGB packed into 32-bit little-endian integer type with byte 0 (least-significant byte) for B, byte 1 for G, byte 2 for R and byte 3 for A.
IMG_FMT_PKBE_ARGB8888
A big endian version of IMG_FMT_PKLE_ARGB8888
IMG_FMT_PKLE_XRGB8888
24-bits/pixel BGR with 8 bits per channel as an ordered byte sequence, followed by a single byte of padding.
IMG_FMT_PKBE_XRGB8888
A big endian version of IMG_FMT_PKLE_XRGB8888

In addition to PKLE and PKBE variants listed above, there are PKHE and PKOE variants that make it easier to identify host-endian (HE) formats and other-endian (OE). So for example, if your code is executing on an x86 platform, IMG_FMT_PKHE_ARGB1555 equals IMG_FMT_PKLE_ARGB1555.

Classification:

Image library