Bug report #3295
SVG images rasterized when printing/exporting
Status: | Closed | ||
---|---|---|---|
Priority: | Low | ||
Assignee: | Marco Hugentobler | ||
Category: | - | ||
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 |
Description
SVG images added to a layout in the print composer are rasterised when printing or exporting to SVG.
Surely this should not be?
History
#1 Updated by Alex Mandel almost 14 years ago
I can confirm this on OSGeo4w 1.5 install, Windows7. Also effects PDF export.
QGIS 1.5+ install on Ubuntu does not have this issue, at least not with the pdf output, I need to double check the svg export.
#2 Updated by JD - almost 14 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 - almost 14 years ago
Attaching a patch to fix this bug/feature.
The QgsComposerPicture was rendering the SVG into a QImage cache and then drawing that image. As QgsComposerPicture is a scene item, it meant that it was never treated as a vector by Qt.
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.
-JD
#4 Updated by Marco Hugentobler almost 14 years ago
- Status changed from Open to Closed
- Resolution set to fixed
Applied in 9cb73c06 (SVN r14973). Thanks!
Marco
#5 Updated by Alex Mandel over 13 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 over 13 years ago
- Resolution deleted (
fixed) - Status changed from Closed to Feedback
Examples and Bug re-opened
Broken windows export
http://blog.wildintellect.com/files/qgisbug/CA_QGISr15130-90dpi.pdf
Working linux export
http://blog.wildintellect.com/files/qgisbug/Counties-linux1.6.pdf
#7 Updated by Alister Hood over 13 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.
#8 Updated by Alister Hood over 13 years ago
#9 Updated by Alex Mandel over 13 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 over 13 years ago
- Status changed from Feedback to Closed
- Resolution set to fixed
#11 Updated by Alister Hood over 13 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)