Hacker News new | past | comments | ask | show | jobs | submit login

Huh, so the PNG actually looks like a real cartridge? How are they able to do that? Is the data section hidden in a non-visible part of the file, or are they able to somehow encode it in there while still having it look visually like a cartridge?



https://pico-8.fandom.com/wiki/P8PNGFileFormat

The images are RGBA PNGs. So for each display pixel there's a byte for each color channel and the alpha channel. The two least significant bits in each byte are a quarter of a PICO-8 data byte. Those bits are read from a channel byte and concatenated in RGBA order to get a data byte.

Using the LSBs for each channel means the those swizzled bits won't contribute very much to that pixel's color value. At worst it would just look like noise in the image.

Also by putting the data inside the image data of a PNG it won't be stripped off by some optimizer or hosting service.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: