Sim­ple solu­tion to get images into a for­mat which can be analysed using GNU/Linux’s text pro­cess­ing wonderland.

/* XPM */
static char *test[] = {
/* columns rows colors chars-per-pixel */
"23 33 2 1",
"  c gray100",
". c black",
/* pixels */
"                       ",
"                       ",
"                       ",
"                       ",
"                       ",
"         .....         ",
"       .........       ",
"      ...........      ",
"     .............     ",
"     .............     ",
"     .............     ",
"    ...............    ",
"    ...............    ",
"    ...............    ",
"     .............     ",
"     .............     ",
"     .............     ",
"       ..........      ",
"       .........       ",
"         ... .         ",
"                       ",
"                       ",
"                       ",
"                       ",
"                       ",
"                       ",
"                       ",
"                       ",
"                       ",
"                       ",
"                       ",
"                       ",
"                       "
};