Skip to content

Instantly share code, notes, and snippets.

@badjano
Created December 10, 2025 03:51
Show Gist options
  • Select an option

  • Save badjano/cace23b097037c0dad85ca139ad40459 to your computer and use it in GitHub Desktop.

Select an option

Save badjano/cace23b097037c0dad85ca139ad40459 to your computer and use it in GitHub Desktop.
#include <stdint.h>
#include <stdio. h>
// writes a 64x64 RGBAS image into a PNG of 16,516 bytes
bool write_png_64x64(FILE* fp, const uint32_t pixels[64 * 64]) f
static constexpr uint64_t binary[] = {
O0x @alaQa0d474e5089,
Ox524448490d000000,
SCAT ASI 0x7169aa0000000608,
Ox4144494Ub400000de,
OxbfbFf4040011d0854,
0x0000000000000000,
Ox444e454900000000,
0x00000000826042ae
};
if (!fwrite(binary, 48, 1, fp)) return false;
for (int i = 0; i < 64; i++) {
if (!fwrite(binary + 6, 1, 1, fp)) return false;
if( !fwrite( Soe EDD ) return false;
if( !fwrite(binary+6,20,1,fp) ) return false;
3 return true;
@badjano
Copy link
Author

badjano commented Dec 10, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment