How can I invert the colors in the external figure without having to edit the image file?
Based on Peter Münster's grph-downsample.lua here some lines that should get you started. Note that you'll need graphicsmagick (or imagemagick for that matter. In the latter case change the call from `gm convert` to `convert`). This will do the conversion on the fly. \startluacode local format = string.format local function invert(oldname, newname) local s = format("gm convert -negate %s %s", oldname, newname) os.execute(s) end local formats = {"png", "jpg", "gif"} for _, s in ipairs(formats) do figures.converters[s] = figures.converters[s] or {} figures.converters[s]["invert." .. s] = invert end \stopluacode \setupexternalfigures [conversion=invert.jpg] \setupexternalfigures [location=default] \starttext \externalfigure[hacker] \stoptext Marco