Created
October 29, 2018 08:49
-
-
Save shimarin/3398320cc11530a0eb8e120925dcdd65 to your computer and use it in GitHub Desktop.
Convert GIMP-generated 16bit image in C Source to array of uint16_t
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include "background.c" | |
int main() | |
{ | |
const unsigned char* pt; | |
printf("const uint16_t background[] PROGMEM = {\n"); | |
for (pt = gimp_image.pixel_data; pt - gimp_image.pixel_data < sizeof(gimp_image.pixel_data); pt += 2) { | |
printf("0x%04x,", *((unsigned short*)pt)); | |
} | |
printf("};\n"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment