Project 01 / Experimental image format
C2PM Color to Pixel Map
I created C2PM to explore an image format that optimizes for color analysis rather than conventional visual decoding.
C2PM (Color-to-Pixel Map) is an experimental image format that inverts the traditional pixel-centric model. Instead of storing pixel-to-color data, I use a color-centric index: each color maps to a list of pixel indices.
Each unique RGB color acts as a key for every location in which it appears. This enables direct color-based queries without scanning the whole image, making the format useful for analytical and experimental workflows rather than general image compression.
Motivation
Most image formats prioritize spatial locality and visual decoding. I wanted to see what changes when image storage is designed for color analysis instead. The project examines storage and access tradeoffs, query efficiency, and the limits of non-spatial image representations.
Design overview
Each unique 24-bit RGB color is stored once, with pixel indices ranging from 0 to width × height − 1. The file includes a header for the magic identifier, image width, height, and color count, followed by sequential color entries and their index arrays.
Strengths & limitations
C2PM gives O(1) access to pixels of a specified color and suits sparse-color images, segmentation masks, and pixel-art-like data. Its tradeoff is storage overhead from index lists and slower decoding than spatial formats, so it is not intended for conventional image display.
Current status
This is an ongoing experiment implemented in C with binary file I/O and custom data structures. Next steps include delta and variable-byte index compression, adaptive index bit-width, and optional spatial metadata for faster reconstruction.