1,282 bytes added
, 10:20, 4 May 2015
< [[Using Graphics]] >
Downsampling means to reduce the resolution of a picture to save space.
There are two simple, but otherwise undocumented modules:
== grph-downsample ==
This MkIV module is not in the distribution, but you can download it from [http://modules.contextgarden.net/grph-downsample here]. It expects the <code>gm</code> tool from [http://www.graphicsmagick.org GraphicsMagick] to be callable.
Copy grph-downsample.lua to <code>.../texmf-local/tex/context/third/grph-downsample/grph-downsample.lua</code>
Call <code>context --generate</code>
Copy <code>hacker.jpg</code> to your directory.
Write this to <code>downsample.tex</code>:
<texcode>
\loadluafile[grph-downsample]
\setupexternalfigures[conversion=lowres.jpg, resolution=10]
\starttext
\externalfigure[hacker.jpg][width=5cm]
\stoptext
</texcode>
The module extends {{cmd|setupexternalfigures}} with the <code>conversion</code> and <code>resolution</code> keys. The former defines an extension to the filename, the latter the final resolution dpi. It works only if the <code>width</code> or <code>height</code> key of {{cmd|externalfigure}} is defined.
<code>conversion=lowres.jpg</code> in the above example creates a temporary file <code>m_k_i_v_hacker.jpg_10.lowres.jpg</code>.
== t-degrade ==