In C2PM, each unique RGB color is stored once, followed by a list of all pixel positions where that color appears. Formally, the format maps:
Color → {Pixel Indices}
This structure enables several properties:
Design Characteristics
Lossless representation of exact RGB images
Direct access to all pixels of a given color without scanning the entire image
Deterministic binary layout (header + entries + index arrays)
Simple linear decoding algorithm suitable for tooling or analysis
Potential Applications
Pixel-art workflows
Palette-based editing systems
Color-region mask generation
Image segmentation and inverse indexing research
Developer tooling that benefits from color-centric access patterns
Current Scope
C2PM is not a replacement for existing compressed formats (PNG, JPEG) and is not optimized for general photography or real-time rendering. It is intended as an alternative representation model focused on color organization rather than storage minimization.
Specification & Implementation
A reference implementation (encoder + decoder in C) and a description of the binary layout are available here:
https://github.com/yukeshj2006/C2PM-Color-to-Pixel-Map-Image-Format
Feedback on structural design, potential optimizations, or use-cases is welcome.
HelloNurse•5m ago
Any interactive application, for instance, can be expected to render the image to the screen (repeatedly); any GPU use for texture mapping needs pixels sorted by location, regardless of whether pixel values are palette indices or explicit colours; many image processing tasks, like segmentation and drawing, need efficient access to pixels at arbitrary locations or near already processed locations.