Bug report #3295
SVG images rasterized when printing/exporting
|Affected QGIS version:||Regression?:||No|
|Operating System:||Windows||Easy fix?:||No|
|Pull Request or Patch supplied:||Resolution:||fixed|
|Crashes QGIS or corrupts data:||Copied to github as #:||13355|
SVG images added to a layout in the print composer are rasterised when printing or exporting to SVG.
Surely this should not be?
#2 Updated by JD - about 12 years ago
This also happens on rev 14936, Kubuntu 10.04, Qt 4.6.2
It appears to happen in the composer rather than the export per se. The attached screenshot shows a highly zoomed area with an arrow drawn with the arrow tool on the left, and the north arrow SVG: north-arrow_1_simple_half_arrow.svg on the right.
The north arrow SVG is definitely a purely vector image, but the SVG exported from composer contains a base64 encoded PNG.
#3 Updated by JD - about 12 years ago
Attaching a patch to fix this bug/feature.
QgsComposerPicture now has a QSvgRenderer member variable as well as the QImage that is used for bitmaps. It now performs no caching of the SVG, instead relying on Qt to draw it in the most efficient way. Indeed, the refresh rate for a native SVG seems much quicker than the cached QImage version, but no timing tests have been done.
As a knock-on effect PDF and SVG export now treat SVGs as vectors rather than rasters.
An arguably more efficient approach would be to use a QPicture to render either a vector or a raster into. This has the advantage that the only time a distinction is made between the two is on loading, thereby simplifying the code and removing a redundant member variable.
#5 Updated by Alex Mandel almost 12 years ago
This does not appear to be fixed on Windows7 (64bit), QGIS 1.5,1.6 and Trunk e5863992 (SVN r15131) and effectively ruins any chance of cartographic workflow involving Inkscape. Ubuntu 10.04 does not appear have the bug using 1.6 ubuntugis repo.
Export of PDF results in groups of Images, pixelation if you look at sample (uploading now). SVG export appears to be lines but is pretty much unusable in Inkscape, there are lots of random lines streaking across.
I'm not saying the patch didn't fix the rendering in the composer, that may be true.
#6 Updated by Alex Mandel almost 12 years ago
- Resolution deleted (
- Status changed from Closed to Feedback
Examples and Bug re-opened
Broken windows export
Working linux export
#7 Updated by Alister Hood almost 12 years ago
Export of PDF results in groups of Images, pixelation if you look at sample (uploading now)
I can confirm that, although it is different to the original bug.
With current trunk on Windows XP an svg is not rasterised in the composer or when exported to svg or printed (whether to a real printer or a virtual PDF printer) but is rasterised when exported to PDF.
SVG export appears to be lines but is pretty much unusable in Inkscape, there are lots of random lines streaking across.
I can't confirm this (it is OK on XP) and I think you should file a separate bug for it.
#9 Updated by Alex Mandel almost 12 years ago
On further testing SVG export appears to be working but pdf does not as noted in #3250
I have not been able to repeat the line streak issue and will open a separate (I think there is one already) about clipping shapes to the output box.
We can probably close this ticket.
#10 Updated by Alister Hood almost 12 years ago
- Status changed from Feedback to Closed
- Resolution set to fixed
#11 Updated by Alister Hood almost 12 years ago
Sorry, lets get those on separate lines:
SVG export works now
Printing works now (but subject to conditions described in comments in #3295)
Printing of vector map layers (rather than SVG images, as described in original bug report) works now (but subject to conditions described in comments in #3295)