Difference between revisions of "Command/externalfigure"

From Wiki
Jump to navigation Jump to search
(Adding information about supported file formats)
m (Formatting)
Line 28: Line 28:
  
 
* '''[http://en.wikipedia.org/wiki/Portable_Document_Format PDF]''': File extension <code>.pdf</code>. By default, ''mediabox'' is used to determine size. Use <code>size=artbox</code> to use ''artbox''.
 
* '''[http://en.wikipedia.org/wiki/Portable_Document_Format PDF]''': File extension <code>.pdf</code>. By default, ''mediabox'' is used to determine size. Use <code>size=artbox</code> to use ''artbox''.
* '''[MPS] (MetaPost Output)''': File extension <code>.mps</code> or <code>.[digits]</code>. Converted to PDF on the fly using MPtoPDF. - - '''[http://en.wikipedia.org/wiki/JPEG JPEG]''': File extension <code>.jpg</code> and <code>.jpeg</code>
+
* '''MPS (MetaPost Output)''': File extension <code>.mps</code> or <code>.[digits]</code>. Converted to PDF on the fly using MPtoPDF.  
 +
* '''[http://en.wikipedia.org/wiki/JPEG JPEG]''': File extension <code>.jpg</code> and <code>.jpeg</code>
 
* '''[http://en.wikipedia.org/wiki/Portable_Network_Graphics PNG]''': File extesion <code>.png</code>
 
* '''[http://en.wikipedia.org/wiki/Portable_Network_Graphics PNG]''': File extesion <code>.png</code>
 
* '''[http://en.wikipedia.org/wiki/JPEG_2000 JPEG 2000]: File extesion <code>.jp2</code>
 
* '''[http://en.wikipedia.org/wiki/JPEG_2000 JPEG 2000]: File extesion <code>.jp2</code>
Line 38: Line 39:
 
* '''[http://en.wikipedia.org/wiki/Scalable_Vector_Graphics SVG]''': File extension <code>.svg</code> and <code>.svgz</code>. Converted to PDF using [http://en.wikipedia.org/wiki/Inkscape Inkscape].  
 
* '''[http://en.wikipedia.org/wiki/Scalable_Vector_Graphics SVG]''': File extension <code>.svg</code> and <code>.svgz</code>. Converted to PDF using [http://en.wikipedia.org/wiki/Inkscape Inkscape].  
  
For the conversion to work, <code>inkscape</code> should be in the <code>PATH</code>. The following command is used for conversion:
+
: For the conversion to work, <code>inkscape</code> should be in the <code>PATH</code>. The following command is used for conversion:
  
  <pre>
 
 
     inkscape [inputfile] --export-dpi=600 -A [outputfile]  
 
     inkscape [inputfile] --export-dpi=600 -A [outputfile]  
  </pre>
 
  
(Note: Conversion to PNG is also possible, but I don't know the details on how to active that -- 03:32, 29 November 2012 (CET)).
+
: (Note: Conversion to PNG is also possible, but I don't know the details on how to active that -- 03:32, 29 November 2012 (CET)).
  
 
* '''[http://en.wikipedia.org/wiki/PostScript PS]''' and '''[http://en.wikipedia.org/wiki/Encapsulated_PostScript EPS]''': File extension <code>.eps</code> and <code>.ai</code>. Converted to PDF using [http://en.wikipedia.org/wiki/Ghostscript Ghostscript].  
 
* '''[http://en.wikipedia.org/wiki/PostScript PS]''' and '''[http://en.wikipedia.org/wiki/Encapsulated_PostScript EPS]''': File extension <code>.eps</code> and <code>.ai</code>. Converted to PDF using [http://en.wikipedia.org/wiki/Ghostscript Ghostscript].  
 
    
 
    
 
    
 
    
For the conversion to work, on Windows <code>gswin32c</code> must be in the <code>PATH</code>; on other platforms <code>gs</code> must be in the <code>PATH</code>. The following command line options are passed to Ghostscript
+
: For the conversion to work, on Windows <code>gswin32c</code> must be in the <code>PATH</code>; on other platforms <code>gs</code> must be in the <code>PATH</code>. The following command line options are passed to Ghostscript
  
<pre>
+
    gs -q -sDEVICE=pdfwrite -dNOPAUSE -dNOCACHE -dBATCH [resolution] -sOutputFile=[outputfile] [inputfile] -c quit
gs -q -sDEVICE=pdfwrite -dNOPAUSE -dNOCACHE -dBATCH [resolution] -sOutputFile=[outputfile] [inputfile] -c quit
 
</pre>
 
  
By default, the <code>[resolution]</code> is ''prepress''. Use <code>resolution=low</code> to change the <code>[resolution]</code> to ''screen'' and <code>resolution=meidum</code> to change the <code>[resolution]</code> to ''ebook''.
+
: By default, the <code>[resolution]</code> is ''prepress''. Use <code>resolution=low</code> to change the <code>[resolution]</code> to ''screen'' and <code>resolution=meidum</code> to change the <code>[resolution]</code> to ''ebook''.
  
 
* '''[http://en.wikipedia.org/wiki/GIF GIF]''': File extension <code>.gif</code>. Converted to PDF using [http://en.wikipedia.org/wiki/GraphicsMagick GraphicsMagick].
 
* '''[http://en.wikipedia.org/wiki/GIF GIF]''': File extension <code>.gif</code>. Converted to PDF using [http://en.wikipedia.org/wiki/GraphicsMagick GraphicsMagick].
  
For the conversion to work, <code>gm</code> should be in the <code>PATH</code>. The following command is used for the conversion:
+
: For the conversion to work, <code>gm</code> should be in the <code>PATH</code>. The following command is used for the conversion:
  
<pre>
+
    gm convert [inputfile] [outputfile]
gm convert [inputfile] [outputfile]
 
</pre>
 
  
 
* '''[http://en.wikipedia.org/wiki/Tagged_Image_File_Format TIFF]''': File extensions <code>.tiff</code> and <code>.tif</code>. Converted to PDF using [http://en.wikipedia.org/wiki/GraphicsMagick GraphicsMagick].
 
* '''[http://en.wikipedia.org/wiki/Tagged_Image_File_Format TIFF]''': File extensions <code>.tiff</code> and <code>.tif</code>. Converted to PDF using [http://en.wikipedia.org/wiki/GraphicsMagick GraphicsMagick].
  
For the conversion to work, <code>gm</code> should be in the <code>PATH</code>. The following command is used for the conversion:
+
: For the conversion to work, <code>gm</code> should be in the <code>PATH</code>. The following command is used for the conversion:
  
<pre>
+
    gm convert [inputfile] [outputfile]
gm convert [inputfile] [outputfile]
 
</pre>
 
  
 
The following movie formats are supported.
 
The following movie formats are supported.
Line 77: Line 70:
 
* '''[http://en.wikipedia.org/wiki/QuickTime QuickTime]''': File extension <code>.mov</code>.  
 
* '''[http://en.wikipedia.org/wiki/QuickTime QuickTime]''': File extension <code>.mov</code>.  
  
(Note: Check if this works?)
+
: (Note: Check if this works?)
  
 
Normally, the type of file is determined by the extension of the file. If the file uses a non-standard extension, then use <code>method=....</code> to specify the file type. If <code>method=<b>auto</b></code> is used, ConTeXt reads the first few bytes of the file to determine the filetype. Such an auto-discovery is useful for remote images that do not have a file extension.
 
Normally, the type of file is determined by the extension of the file. If the file uses a non-standard extension, then use <code>method=....</code> to specify the file type. If <code>method=<b>auto</b></code> is used, ConTeXt reads the first few bytes of the file to determine the filetype. Such an auto-discovery is useful for remote images that do not have a file extension.

Revision as of 22:03, 30 November 2012

\externalfigure

Syntax

\externalfigure[...][...,...=...,...]
[...] file
[...,...=...,...] see \useexternalfigure


Description

Command to include an external figure/movie inside ConTeXt. Includes both local files or remote files hosted on HTTP servers.

The following image formats are supported natively in MkIV:

  • PDF: File extension .pdf. By default, mediabox is used to determine size. Use size=artbox to use artbox.
  • MPS (MetaPost Output): File extension .mps or .[digits]. Converted to PDF on the fly using MPtoPDF.
  • JPEG: File extension .jpg and .jpeg
  • PNG: File extesion .png
  • JPEG 2000: File extesion .jp2
  • JBIG and JBIG2: File extension .jbig, .jbib2, and .jb2

The following formats are converted to PDF by external programs before being included. The conversion generates a new file with a prefix m_k_i_v_ and a suffix .pdf added to the name of the original file (the original extension is nor removed). The result is cached, and the conversion is rerun only if the timestamp of the original file is newer than the converted file.


  • SVG: File extension .svg and .svgz. Converted to PDF using Inkscape.
For the conversion to work, inkscape should be in the PATH. The following command is used for conversion:
   inkscape [inputfile] --export-dpi=600 -A [outputfile] 
(Note: Conversion to PNG is also possible, but I don't know the details on how to active that -- 03:32, 29 November 2012 (CET)).


For the conversion to work, on Windows gswin32c must be in the PATH; on other platforms gs must be in the PATH. The following command line options are passed to Ghostscript
   gs -q -sDEVICE=pdfwrite -dNOPAUSE -dNOCACHE -dBATCH [resolution] -sOutputFile=[outputfile] [inputfile] -c quit
By default, the [resolution] is prepress. Use resolution=low to change the [resolution] to screen and resolution=meidum to change the [resolution] to ebook.
For the conversion to work, gm should be in the PATH. The following command is used for the conversion:
   gm convert [inputfile] [outputfile]
For the conversion to work, gm should be in the PATH. The following command is used for the conversion:
   gm convert [inputfile] [outputfile]

The following movie formats are supported.

(Note: Check if this works?)

Normally, the type of file is determined by the extension of the file. If the file uses a non-standard extension, then use method=.... to specify the file type. If method=auto is used, ConTeXt reads the first few bytes of the file to determine the filetype. Such an auto-discovery is useful for remote images that do not have a file extension.

In addition, the following special formats are supported:

  • buffer: Typeset the buffer with the given name and include the result as a PDF file.
  • tex: Typeset the TeX file using context and include the result as a PDF file
  • cld:


Note: The file extesions are case insensitive.


Example

See also

Help from ConTeXt-Mailinglist/Forum

All issues with: