Inkscape should export to a pure vector PDF file. There is no need to tweak the DPI
value or using the --export-dpi
option, since it only affects the rasterized output that you want to avoid.
It can be problematic to convert from one vector format to another. That only works under two conditions:
- The target format supports all the features of the source format (or these features cannot be used)
- There is a conversion program that knows how to map the features from the source to the target format
Problems most likely occur if you use gradients or filters. I don't know how well inkscape handles the conversion of gradients, but when filters are used, the output is always rasterized.
A workaround would be to use the option --export-ignore-filters
. Instead of applying the filters and to rasterize the output, inkscape ignores the filters and keeps the vector format, which is — in my opinion — almost always a way better choice.
Here is an example to convert the file drawing.svg
to drawing.pdf
:
inkscape \
--export-pdf=drawing.pdf \
--export-ignore-filters \
--export-area-drawing \
drawing.svg
--export-ignore-filters
forces inkscape to not use filters, which would rasterize the output. --export-area-drawing
is used to set the bounding box. Without this option the entire page would be exported.
Problem was that as far as LyX is concerned .sty
files are raw LaTeX, hence only the file gets copied to the temporary directory where LyX does the compilation but not the dependencies referenced in that file - these get resolved only for .lyx
files.
I went with using an absolute path \graphicspath{{/home/username/latex/example/images/}}
. That's going to give me trouble only when I move it to a new directory or computer - and then I would have only to change the directory reference.
Best Answer
Expanding my comment into an answer:
Any raster objects in a PDF are put inside a container so they appear vectorized, since PDF is natively a vector format. So from the point of view of
graphicx
, the image is already vectorized, even though it's technically not, only encapsulated by a vector format.The only way to get interpolation in a PDF would be to produce it before the PDF is produced from the raster graphic. Or simply include the original raster graphic in a raster format supported by
graphicx
, with appropriate compression applied if needed.The example requires
--shell-escape
, ImageMagick, and a copy ofexample-image-a.png
(from themwe
package) placed in the same directory as the example's.tex
file: