| #include <stdio.h> | |
| #define STB_IMAGE_IMPLEMENTATION | |
| #include "stb_image.h" | |
| stbi_uc poc_data[] = | |
| { | |
| 0x89,0x50,0x4E,0x47,0x0D,0x0A,0x1A,0x0A,0x00,0x00,0x00,0x0D,0x49,0x48,0x44,0x52,0x00, | |
| 0x00,0x00,0x0A,0x00,0x00,0x00,0x0A,0x08,0x03,0x00,0x00,0x00,0xBA,0xEC,0x3F,0x8F,0x00, | |
| 0x00,0x00,0x03,0x50,0x4C,0x54,0x45,0x00,0x00,0x00,0xA7,0x7A,0x3D,0xDA,0x00,0x00,0x00, | |
| 0x11,0x49,0x44,0x41,0x54,0x78,0xDA,0x63,0x60,0x00,0x81,0x14,0x10,0x60,0xA0,0x3D,0x13, | |
| 0x00,0x02,0x0E,0x13,0x89,0x61,0xBE,0x38,0x07,0x00,0x00,0x00,0x00,0x49,0x45,0x4E,0x44, | |
| 0xAE,0x42,0x60,0x82 | |
| }; | |
| int main(int argc, char** argv) { | |
| int w, h, c; | |
| unsigned char *img = stbi_load_from_memory(poc_data, (int)sizeof(poc_data), &w, &h, &c, 0); | |
| if (!img) return 1; | |
| int leaked = 0; | |
| for (int i = 0; i < w * h * c; i++) | |
| if (img[i] != 0x00) leaked++; // palette only has black | |
| printf("Non-zero bytes: %d / %d\n", leaked, w * h * c); | |
| stbi_image_free(img); | |
| return 0; | |
| } |