Downsampling

From Wiki
Revision as of 10:20, 4 May 2015 by Hraban (talk | contribs) (new page, first save)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

< 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 here. It expects the gm tool from GraphicsMagick to be callable.

Copy grph-downsample.lua to .../texmf-local/tex/context/third/grph-downsample/grph-downsample.lua

Call context --generate

Copy hacker.jpg to your directory.

Write this to downsample.tex:

\loadluafile[grph-downsample]
\setupexternalfigures[conversion=lowres.jpg, resolution=10]
\starttext
\externalfigure[hacker.jpg][width=5cm]
\stoptext

The module extends \setupexternalfigures with the conversion and resolution keys. The former defines an extension to the filename, the latter the final resolution dpi. It works only if the width or height key of \externalfigure is defined.

conversion=lowres.jpg in the above example creates a temporary file m_k_i_v_hacker.jpg_10.lowres.jpg.


t-degrade