https://github.com/notreeceharris/rgba-data-encoder
Encode data into a PNG using RGBA pixel channels.
https://github.com/notreeceharris/rgba-data-encoder
compression encoder-decoder lossless steganography
Last synced: 9 months ago
JSON representation
Encode data into a PNG using RGBA pixel channels.
- Host: GitHub
- URL: https://github.com/notreeceharris/rgba-data-encoder
- Owner: NotReeceHarris
- License: gpl-3.0
- Created: 2025-07-14T19:37:27.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-07-14T21:33:32.000Z (11 months ago)
- Last Synced: 2025-09-17T13:55:15.394Z (9 months ago)
- Topics: compression, encoder-decoder, lossless, steganography
- Language: TypeScript
- Homepage:
- Size: 73.9 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RGBA Data Encoder
This project encodes arbitrary data into PNG images by packing raw bytes into RGBA pixel channels. It works by converting input data into hexadecimal format, then storing two hex characters (one byte) per PNG channel (R, G, B, A), achieving 8 hex characters (4 bytes) of storage per pixel.
The encoding is completely lossless - files can be perfectly reconstructed from the generated images. However, this is not a compression algorithm. For already compressed files like PDFs or videos, the PNG output will typically be slightly larger than the original. For uncompressed text files, the size remains about the same.
Some example encodings are included:
- [doom.pdf](https://github.com/ading2210/doompdf) encodes to 4.8MB (original 6.2MB) -1.4MB
- The [Bad Apple video](https://dn720401.ca.archive.org/0/items/TouhouBadApple/Touhou%20-%20Bad%20Apple.mp4) encodes to 37.8MB (original 21.7MB) +16.1MB
While this doesn't compress data, it provides an interesting way to represent any file as an image. Potential uses include archival storage, steganography, or simply as a novelty encoding method. The simple byte-level packing ensures reliable round-trips with no data loss.
Below is [doom.pdf](https://github.com/ading2210/doompdf) as a image, in this case data has been compressed:

The compression isnt amazing and in most cases it doesnt compress but increases depending on the original data format, for example here is [bad apple](https://dn720401.ca.archive.org/0/items/TouhouBadApple/Touhou%20-%20Bad%20Apple.mp4) encoded:
