Changes

Jump to navigation Jump to search
202 bytes added ,  09:49, 12 August 2022
m
small enhacements
== File Formats ==
ConTeXt natively supports the image formats enumerated below. The image format is determined from the file extension (case insensitive).
* '''PDF''': File extension <tt>.pdf</tt>
<td align="left"><strong>GIF</strong></td>
<td align="left"><code>.gif</code></td>
<td align="left"><code>gmconvert</code> from GraphicsMagick</td>
</tr>
<tr class="odd">
<td align="left"><strong>TIFF</strong></td>
<td align="left"><code>.tiff</code></td>
<td align="left"><code>gmconvert</code> from GraphicsMagick</td></tr><tr class="even"><td align="left"><strong>BMP</strong></td><td align="left"><code>.bmp</code></td><td align="left"><code>gm convert</code> from GraphicsMagick</td>
</tr>
</table>
The conversion generates a PDF file with prefix <tt>m_k_i_v_</tt> and a suffix <tt>.pdf</tt> added to the name of the original file. The result is cached, and the conversion is rerun re-run if the timestamp of the original file is newer than that of the converted file.
In LMTX , the file name contains md5sum of a MD5 hash of the relevant source image parameters (resolution, dimensions, ...), e.g.:
<pre>
<pre>
\startluacode
local function converterdownsampler(oldname, newname, resolution)
if not resolution or resolution == "" then
resolution = 50
end
os.execute(string.format(
'gm convert -density %ix%i "%s" "%s"',
resolution, resolution, oldname, newname)
)
-- Set the PDF and default TIFF converters to the above function.
figures.converters.tif.pdf = converterdownsamplerfigures.converters.tif.default = converterdownsampler-- Hint: This works also for jpg or png!
\stopluacode
</pre>
See also: https://source.contextgarden.net/tex/context/base/mkiv/{{src|grph-inc.lua}}
== Interaction ==

Navigation menu