ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Multiple image conversions
@ 2018-12-16 20:18 Marco Patzer
  0 siblings, 0 replies; only message in thread
From: Marco Patzer @ 2018-12-16 20:18 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi!

I wonder if/how it's possible to specify multiple image conversions. Example:

\startluacode
  local format = string.format
  local function degradejpg(oldname, newname)
    local s = format("gm convert -strip -quality 75%% -resize '300x300>' %s %s", oldname, newname)
    os.execute(s)
  end
  local function degradepng(oldname, newname)
    local s = format("gm convert -strip -resize '500x500>' %s %s", oldname, newname)
    os.execute(s)
  end
  figures.converters.jpg["degrade.jpg"] = degradejpg
  figures.converters.png["degrade.png"] = degradepng
\stopluacode

\setupexternalfigures
  [location=default,
   %% conversion=degrade.png, %% how to use both?
   conversion=degrade.jpg]

\starttext
  \externalfigure [hacker]
  \externalfigure [mill]
\stoptext

I'd like to avoid specifying the filetype-specific conversion with each
\externalfigure command:

  %% this works, but it clutters the document and one has to check the
  %% file type each time
  \externalfigure [mill] [conversion=degrade.png]

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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-12-16 20:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-16 20:18 Multiple image conversions Marco Patzer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).