> 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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to