Inkscape can be used to convert SVG files to another form. Right now, the command line can be used to generate Portable Network Graphic (PNG), PostScript (PS), Encapsulated PostScript (EPS), Portable Document Files (PDF), and plain SVG files. More options are available from within Inkscape using the Save As or Export Bitmap dialogs.
The export options can be divided into three classes: those that specify the output format, those that specify the region to export, and those that specify properties such as background color in the exported image.
The output file name must be
given (except for the --print
option).
Warning | |
---|---|
Transparency and patterns are not supported in exports to PS and EPS files. Font information may also not be preserved. |
-e
, --export-png
Export a PNG file.
-P
, --export-ps
Export a PS file.
-E
, --export-eps
Export an EPS file.
-A
, --export-pdf
New in v0.45.
Export a PDF file.
-l
, --export-plain-svg
Export a plain SVG file. A plain SVG has all the Inkscape-specific information and the RFD meta-data removed. A program that displays SVG files should ignore all such information according to the SVG specification, so this option should not in principle be necessary.
-p
, --print
Outputs PS data that can be used as input to another program via a pipe (|) or dumped into a file via >. The parameters to this option must be quoted properly.
For example, on Linux to send the output to a file, use:
inkscape --print '> test.ps' test.svg
At the moment, these options only affect bitmap export except
the --export-bbox-page
, which applies to
EPS exports.
Note | |
---|---|
Most PostScript display programs will only display what is inside
the rectangle defined by the PostScript
BoundingBox parameters (if they are
set). EPS files must contain a
BoundingBox. It is optional for
PS files. By default, Inkscape sets the
BoundingBox to the page area for
PS files and to the drawing bounding box for
EPS files (both at 72 dpi). The
|
-a
, --export-area
Specifies the rectangular region that should be exported. Requires the coordinates of the lower-left corner and the upper-right corner in the format: x0:y0:x1:y1. (The lower-left corner of the drawing has coordinates of 0,0.) The units are in SVG user units.
Example: to export the left half of a 200 by 100 pixel drawing to a PNG:
inkscape --export-area=0:0:100:100 --export-png=test.png test.svg
-C
, --export-area-canvas
The area exported will correspond to the area defined by the page.
The option should be named --export-area-page
.
-D
, --export-area-drawing
The area exported will correspond to the bounding box of all objects in a drawing, including any that are not on the page.
--export-area-snap
The area exported will be increased outward to the nearest integer value. This option has two effects: 1. If you have aligned all your objects to a pixel grid (to reduce anti-aliasing effects) but the export area bounding box is not aligned to the grid, it will ensure that the exported pixmap will be aligned to the same grid. 2. It will ensure that the edges of the drawing will not be clipped.
-i
, --export-id
The area exported will be defined by the bounding box of the named object. The exported drawing will include the parts of any other objects that fall within this bounding box. The name of a given object can be found by selecting the object from within Inkscape and looking at the XML Editor. (Of course, if you do this, you may as well export using the Export Bitmap dialog.)
-j
, --export-id-only
Only the specified object is exported. Must be used with the
--export-id
option. See above. Can be used
with --export-area-canvas
and
--export-area-page
.
-B
, --export-bbox-page
For use with EPS export only. If the option is used, the value of the PostScript BoundingBox parameter will be set to the page area (at 72 dpi). Most PostScript viewers will clip the drawing to this area. Without this option, the BoundingBox parameter is set to match the bounding box of the Inkscape drawing.
The first few options are for bitmap exports, while the last few are for PS and EPS export.
-d
, --export-dpi
An exported bitmap will be scaled by the ratio of the given
number to the SVG user unit. The default value is 90, which
matches the internal scale used by Inkscape; i.e., a value of
90 means that one Inkscape pixel corresponds to one exported
pixel. A value of 72 means that one Inkscape
point corresponds to one exported pixel.
(See the section called “Inkscape Coordinates”.) This option overrides
the --export-use-hints
option.
-w
, --export-width
An exported bitmap will be scaled so that the width is equal to the specified
number of pixels. Overrides --export-dpi
.
-h
, --export-height
An exported bitmap will be scaled so that the height is equal to the specified
number of pixels. Overrides --export-dpi
.
-b
, --export-background
Use the specified color for the background of bitmap export. Any SVG-supported color string may be used (e.g., #ffc0cb, rgb(255, 192, 203), or “pink”). See SVG color keywords for a list of defined colors. If this option is not used, the color specified by the “pagecolor” attribute in the section “sodipodi:namedview” of the SVG file will be used (if it is defined).
-y
, --export-background-opacity
Use the specified value for the background transparency or opacity. Either a number between 0.0 and 1.0 or an integer from 0 to 255 can be used, where the smaller number in both cases corresponds to full transparency and the larger number corresponds to full opacity. Note: 1 is interpreted as full transparency.
-t
, --export-use-hints
If you have previously saved an object to a bitmap image from
within Inkscape (and saved the file afterward), you can use
this option to export the object to a bitmap file with the same
name and resolution. Must be used with the
--export-id
option.
-T
, --export-text-to-path
The text objects should be converted to paths prior to export to a PS or EPS export. Then ensures that the text will be rendered properly regardless of which fonts are installed on a computer that displays or a printer that prints the resulting file.
-F
, --export-embed-fonts
New in v0.45.
Embed fonts in PS or EPS files. Works only with Type 1 fonts.
© 2005-2008 Tavmjong Bah. | Get the book. |