biolab / orange3

🍊 :bar_chart: :bulb: Orange: Interactive data analysis
https://orangedatamining.com
Other
4.85k stars 1.01k forks source link

Blurry rendering of saved images (svg, pdf) #4384

Closed Hrovatin closed 4 years ago

Hrovatin commented 4 years ago

When exporting large heat maps in pdf and svg they are displayed blurry in some programs. This might be because of the image settings. Top left: pdf in pdf viewer. Top right: pdf in web browser (blurry). Bottom left: svg in Inkscape (blurry). Bottom right: svg in Inkscape with setting object properties (right click on heatmap) -> Image Rendering -> optimizeSpeed. Screenshot from 2020-01-30 14-12-25 Also the colours in pdf and svg are a bit different. Could this be because of CMYK/RGB settings?

markotoplak commented 4 years ago

In theory this could be added to the generated svg, see for example https://stackoverflow.com/questions/50184674/stop-auto-image-smoothing-inside-an-svgz

I have no idea how to fix this. I tried playing with QPainter's render hints but came nowhere. A possible (but wasteful) workaround would be to have each pixel shown by 2x2 or 3x3 pixel patch.

janezd commented 4 years ago

Render hints won't help: SVG head is hard-coded: https://github.com/qt/qtsvg/blob/4cdd71fd2070e439ef7daa8f932f19f76020a45b/src/svg/qsvggenerator.cpp#L896.

I would go quick and dirty: save the file and then insert style="image-rendering:optimizeSpeed;image-rendering:pixelated" after <svg.

janezd commented 4 years ago

Moved to https://github.com/biolab/orange-widget-base/issues/45.