in reply to Creating X BitMap (XBM) images with directional gradients

The XBM this program makes is obviously valid in some sense, but ImageMagick doesn't like it (nor does NetPBM). To fix that, write_xbm needs tweaking to replace this:
$fh->say("static unsigned char ${indexed_name}_bits[] = { " . +join(', ', $hexes->@*) . ' };');
with:
$fh->say("static unsigned char ${indexed_name}_bits[] = {"); $fh->say(join(', ', $hexes->@*)); $fh->say('};');

Replies are listed 'Best First'.
Re^2: Creating X BitMap (XBM) images with directional gradients
by soonix (Chancellor) on Aug 07, 2024 at 21:56 UTC
    wouldn't the only difference of the two be the space after the opening squiggle, and the space before the closing one?
      Yes. The two image libraries referred to don't seem to be excellent at parsing C code (which isn't entirely unreasonable), so the above change gives them a little extra help.