Changes

Jump to navigation Jump to search
229 bytes removed ,  05:26, 11 June 2020
m
< [[Graphics]] | [[Combinations]] | [[File Formats|Supported Media File Formats]] | [[Including pages from PDF documents]] | [[Animation]] | [[Downsampling]] >
 
= Usage =
* '''JPEG 2000''': File extension <tt>.jp2</tt>
* '''JBIG''' or '''JBIG2''': File extension <tt>.jbig</tt>, <tt>.jbig2</tt>, or <tt>.jb2</tt>
 
An old page (2010), gives details on supported [[File Formats|file formats]]
== Image Conversion ==
It is possible to change the converter used with the following code:
<pre><code>
\startluacode
 figures.converters["jpg"]["lowres.jpg"] =local functionconverter(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) )
end
-- Set the PDF and default TIFF converters to the above function.
figures.converters.tif.pdf = converter
figures.converters.tif.default = converter
\stopluacode
\starttext
% Substitute any TIFF here. \externalfigure [t:/sources/hacker.jpg] [conversion=lowrescow.jpg,resolution=50,width=10cmtiff]
\stoptext
</codepre>< See also: https:/pre>/source.contextgarden.net/tex/context/base/mkiv/grph-inc.lua
== Interaction ==
By default, the interactive elements of the included PDF file are discarded. To enable the interactive elements of the included PDF file, use
<texcode>\externalfigure[filename.pdf][interaction=yes]</texcode>
 
For further reading, don't forget [[Including pages from PDF documents]].
== Image Directory ==
== Image Scaling ==
 
{{ note | If either <tt>width</tt> or <tt>height</tt> is specified, then the <tt>scale</tt> key has no effect. }}
 
To scale an image use the <tt>scale</tt> key: <tt>scale=1000</tt> corresponds to the original dimensions of the image, <tt>scale=500</tt> scales the image to 50% of the original size, <tt>scale=1500</tt> scales the images to 150% of the original size, and so on. For example:
<texcode>\externalfigure[logo.pdf][scale=500]</texcode>
 
scales the image to 50% of its size.
Use <tt>\setupexternalfigures</tt> to set the scale of all images. For example, to scale all images to be twice their original size, use:
<texcode>\setupexternalfigures[scale=2000]</texcode>
 
If either <tt>width</tt> or <tt>height</tt> is specified, then the <tt>scale</tt> key has no effect.
In addition, the <tt>xscale</tt> and <tt>yscale</tt> keys scale the image in only one dimension. For example:
<texcode>\clip[nx=3,ny=3,x=2,y=2]
{\externalfigure[logo.pdf]}</texcode>
 
 
In PDF files, it is possible to specify different size information in PDF headers MediaBox, TrimBox, CropBox, and ArtBox. To clip to one of these sizes, use
 
<texcode>\externalfigure[logo.pdf][size=art]</texcode>
 
Other options are: `none` (detault), `media` for MediaBox, `crop` for CropBox, `trim` for TrimBox, and `art` for ArtBox.
= Troubleshooting =
ConTeXt includes a Perl script <tt>pdftrimwhite</tt> that removes extra white space at the borders of a PDF file. To run this script:
<pre>mtxrun --script pdftrimwhite <em>[flags] input output</em></pre>
The most important flag is <tt>--offset=dimen</tt>, which keeps some extra space around the trimmed image.
= [[Floating Objects]] =
 
Floats are numbered and placed by ConTeXt, with a configurable (and optional) caption.
 
<texcode>
\placefigure[place]{My Caption}{\externalfigure[myone]}
</texcode>
<tt>place</tt> is one of:
left, right, here, top, bottom, inleft, inright, inmargin, margin, page, opposite, always, force, tall
 
You get ''no'' caption with <tt>none</tt>.
You get a table of figures with {{cmd|showexternalfigures}}<code>[alternative=a]</code>. Alternatives (styles) a, b and c are predefined.
 
The second brackets of {{cmd|placefigure}} can contain any command, e.g. {{cmd|getbuffer}}.
 
You find more about floats ([[Floating Objects]]) in the manual.
= Movies =
</nowiki></pre>
= See Also =
 
* [[Animation]]
* [[Example photo page layout]]
* [[Graphical_text_manipulation|scaling, rotating, mirroring, clipping]]
[[Category:Graphics]]
 
 
{{Getting started navbox}}

Navigation menu