Skip to content

Instantly share code, notes, and snippets.

@shimarin
Created October 29, 2018 08:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shimarin/3398320cc11530a0eb8e120925dcdd65 to your computer and use it in GitHub Desktop.
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
#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