I'm creating some histograms for use in a scientific article, The final figure is supposed to be a few graphs, each with two sets of data plotted showing how similar they are. In my example, I used Julia to generate two sets of data, and used Gadfly to draw the overlay to an SVG file. This was achieved by layering the histograms with some transparency in the bars. I opened the SVG file in Inkscape and added text descriptions and then saved it as a pdf for use in my tex file. However, the pdf do not display the transparency and just put one layer on top of the other with no interaction between the two. Oddly enough, the thumbnail preview panel in Evince does show the picture properly, which led me to think that it was simply a deficiency of Evince. I tried viewing the pdf in Okular, but there both the thumbnail preview and the pdf itself do not show the transparency. I'm somewhat confused as to where the problem actually is.

I dropboxed the SVG in question here and the PDF output here. The thumbnail in Evince looks like img, which is what I'm shooting for (except not for ants).

I'd really appreciate any advice on the matter. Thanks for the read!

  • Importing the SVG to Open/Libre Office can do that - see edit of my answer.
    – Takkat
    Dec 6, 2015 at 17:17

2 Answers 2


Unfortunately the PDF format available from Inkscape does not support transparency. To still be able to create a PDF with an Inkscape drawing having transparent objects we will have to convert these to bitmap first.

For a single object or group this can be done with the Filter > Transparency utilities > Light Eraser.

We have to be aware that this filter does not preserve colors as expected. To obtain the results of such a conversion as it is displayed below I had to add another 90% opacity to the columns object's fill and stroke property.

enter image description here PDF with partly converted to bitmap with Light Eraser shown in Evince

When using another application for converting to PDF we get much better results. An Open Source application capable of doing so would be Open/Libre Office, which allows transparency on PDF export (objects are not converted to bitmaps):

enter image description here SVG imported to Libre Office, exported to PDF as shown in Evince

  • Thanks for your help! I've accepted your answer; however, the folks over at the Inkscape forum had a neat workaround that I thought people should be aware of: inkscapeforum.com/…
    – Bobby
    Dec 7, 2015 at 23:21
  • @Bobby: post this solution as a own answer to your question? This may help others.
    – Takkat
    Dec 8, 2015 at 7:04

As suggested in (see the second answer, not the first)


setting alpha channel value instead of opacity works.

Unfortunately, I've read the solution after finishing a complex design which had hundreds of shapes in it. Therefore, manually setting opacity back to 100% and then setting to alpha channel value to something lower than 255 was not an option. Fortunately, "sed" utility of *NIX systems saved me (note that SVG is nothing but a text file). Here is the command that I used

sed 's/opacity:0\.\([0-9]*\)\(;fill[^ ]*fill-opacity:\)1/opacity:1\20\.\1/' input_with_opacity.svg > output_with_alpha.svg

It switches between values of opacity and alpha channel (named fill-opacity) for all objects in the file. For instance, if you have a line


in the original file, it will become


in the new file. Well, it may need some tweaking for your files, but it should not be too hard to do so. One caveat is that you may need to ungroup all your objects before running this since "style" format for grouped objects may be different.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.