Allow import/export via stdin/stdout

Bug #171016 reported by Bug Importer on 2005-11-29
This bug affects 10 people
Affects Status Importance Assigned to Milestone

Bug Description

I would love to be able to use Inkscape to convert SVG
to PNG, but I can't do it without using files as
intermediates. Please allow Inkscape to read SVG from
stdin and write output to stdout. This can easily be
done by checking for the special file names for '-'.


Bug Importer (bug-importer) wrote :

I strongly support this feature request. Actually, I wanted
to submit exactly the same request myself, but found this


Bug Importer (bug-importer) wrote :

i want to request the same feature for inkview.

it would be *very* nice to use it together with any svg
generating application that outputs/can output svg(z) to
stdout... like dot (from graphviz)

Timo (<email address hidden>)

Rob263 (rob263) wrote :

Originator: NO

I would consider helping to code this enhancement, but I've never worked
on the Inkscape code before, so I'd need someone to point me in the right
direction in terms of which files/classed to start with.

nightrow (jb-benoit) on 2007-12-18
Changed in inkscape:
importance: Undecided → Wishlist
status: New → Confirmed
Niko Kiirala (kiirala) wrote :

To some extent, this can already be done by using special files /dev/stdin, /dev/stdout and /dev/stderr. Inkscape does emit a warning that it cannot determine the type of such a file, and tries to open it as SVG file.

On Windows those files obviously don't exist, but with mighty luck, same could be done using special filename con. I wouldn't hold my breath, though.

Tom Davidson (tjd-mit) wrote :

As was noted by tweenk in bug 174717 (marked as a dupe of this one) the /dev/stdin trick doesn't work for inkview. This is especially odd since inkview can autodetect svg files with missing file extensions.

Changed in inkscape:
status: Confirmed → Triaged
Marco Patzer (mpfusion) wrote :

Working with /dev/stdin and /dev/stdout doesn't really work:

$ inkscape -l /dev/stdout file.svg | head -2
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape ( -->
terminate called after throwing an instance of 'Inkscape::IO::StreamException'
  what(): ERROR writing to file

Emergency save activated!
Emergency save completed. Inkscape will close now.
If you can reproduce this crash, please file a bug at
with a detailed description of the steps leading to the crash, so we can fix it.
** Message: Error: Inkscape encountered an internal error and will close now.

However this works:

$ inkscape -l /dev/stdout file.svg | cat | head -2
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape ( -->

It would be really nice to have proper stdin - stdout behaviour like most other programs.

su_v (suv-lp) on 2011-09-24
tags: added: cli importing
removed: import-export
Vassilis Virvilis (vasvir) wrote :


+1 for this

If I use the /dev/stdout trick it doesn't really work because inkscape writes other stuff in the stdout and corrupts the png exported image.

I have to use | tail -n +3

Generally it is a pain to work with it in filters

For example

inkscape -z -b white -e a2.png a2.svg
parsing error: 1:618:could not recognize next production --> this is stderr
Background RRGGBBAA: ffffffff --> the rest is stdout
Area 0:0:1536:816 exported to 1536 x 816 pixels (96 dpi)
Bitmap saved as: a2.png

Thanks in advance

BrenBarn (brenbarn-c) wrote :

How nice to see this bug has been open for over 12 years with no progress. What a joke.

anatoly techtonik (techtonik) wrote :

Because it needs a patch.

I created separate issue for `inkview` -

I could send a patch if `inkview` was written in Python (or Go WFIW), but it is not.

Patrick Storz (ede123) wrote :
Changed in inkscape:
milestone: none → 0.92.4
status: Triaged → Fix Committed
Vassilis Virvilis (vasvir) wrote :

Glad to hear that.

One problem closely related to this is that inkscape mixes stdout with stderr

I work around this with that.

inkscape -z -b white /dev/stdout /dev/stdin 2>/dev/null |
   sed -e '/^DPI:.*$/d' -e '/Background RRGGBBAA:.*$/d'
       -e '/Area 0:0:.*)$/d' -e 's/Bitmap saved as:.*stdout//g' |
   sed -z -e '$s/\\x0a$//g

Hopefully the commits you mentioned also take case of this.

Patrick Storz (ede123) wrote :

> One problem closely related to this is that inkscape mixes
> stdout with stderr

That particular issue was addressed in the commits mentioned.

However in the master branch there was yet another rewrite of the code in question, so some additional testing would be welcome.

Vassilis Virvilis (vasvir) wrote :

No problem to test preferably when 0.92.4 hits debian unstable.

Alternatively I could test it on flatpack or snap but that packages are the same or behind debian unstable.

Building from source is more involved but if you think that is required I could give it a try.

Thanks for all your efforts towards a very nice, useful and very well behaving software.

Bryce Harrington (bryce) on 2019-01-18
Changed in inkscape:
status: Fix Committed → Fix Released
Vassilis Virvilis (vasvir) wrote :

Hi this bug has resurfaced with 1.0.1 in Debian unstable.

This command
inkscape --export-type=png -p < a.svg > a.png

  -lots of stuff in stderr: Cool
  -lots of lines before the PNG header: Not cool

The lines are of the form:
WARNING: Requested update while update in progress, counter = 5 (repeated 3064 times)
96dpi (repeated 84 times)

I think this printouts shouldn't go to stdout. That breaks the output files on stdout

I can provide the a.svg if required.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers