Color smoothing after impor to Inkscape

Added by Juan Jose 3 months ago

Hi, I have a problem that has been bothering me since several years ago, and I basically learnt to live with it. But perhaps it's worth to ask others as it must be a rather common issue.

In my current workflow I produce postscript files, and within the sames script I use psconvert to keep just the pdf files. I collect those pdf's to examine results. Then, when I'm preparing a publication, I use a graphical tool, typically Inkscape (and sometimes Gimp, after rastering the pdf) to make composites with various figures. Therefore, importing pdf's into Inkscape is an important part of my workflow. Well, the problem is that when importing, figures produced with discrete paletes look "smoothed". I took snapshots to explain better what I mean:

This is the raw pdf after being converted with psconvert:

And this is the image after beeing imported to Inkscape

Clearly it is not just an issue of resolution, as the other elements in the figure are sharp (e.g. labels). It has to do just with colours in grdimage and psscale. Any idea how to avoid this behaviour?

Thank you very much!


Replies (6)

RE: Color smoothing after impor to Inkscape - Added by Joaquim 3 months ago

I think Inkscape converts to an intermediate file in SVG format and than loads it. Quite likely the blurring happens at that step.

RE: Color smoothing after impor to Inkscape - Added by Juan Jose 3 months ago

So far I could not find a workaround. I tried pdf2svg, which as far as I can tell is a completely independent approach to Inkscape. However, the svg file I get has the same issue. I'll keep trying to find the a suitable solution and then report it.

RE: Color smoothing after impor to Inkscape - Added by Joaquim 3 months ago

I converted our example 12 (from gallery) to pdf first and to svg next, using this converter http://www.cityinthesky.co.uk/opensource/pdf2svg, and when loaded in inkscape the colors were not blurred. Actually, the individual color patches were well preserved.

RE: Color smoothing after impor to Inkscape - Added by Juan Jose 3 months ago

Thanks for the answer. I believe a major difference between your test and mine is that in example 12 pscontour is used. In my experience, only grdimage and psscale produce such effect.

Actually, I came up with a minimal example that reproduces the issue.

gmt makecpt -Cpolar -T-9/9/2 -D > pepe.cpt

gmt psscale -Cpepe.cpt -Dx0/0+w10c/.4c+h+e+o0/0.5c > test.ps

gmt psconvert -Tf -A test.ps
pdf2svg test.pdf test.svg
convert test.pdf test1.png
convert test.svg test2.png

I convert from PDF to SVG using the very same tool you did. However, I get a smoothed SVG, which I can verify when I convert both to PNG with Imagemagick. I attach all files I get in case you can not reproduce the problem.

Thank you very much for the interest!

test2.png (2 KB)

test.pdf (4.37 KB)

test1.png (1.09 KB)

test.svg (13.2 KB)

RE: Color smoothing after impor to Inkscape - Added by Joaquim 3 months ago

Yes, I can reproduce it too. It's the conversion to svg that indeed screws.

RE: Color smoothing after impor to Inkscape - Added by Evan 28 days ago

I tried importing one of my figures using Inkscape 0.92, and they seem to have resolved the issue, at least with the psscale output. With the results from grdimage, Inkscape fails to import anything except for the transparency mask, which it colours grey. You can still use the poppler import, but it makes a blurry mess like before.

Edit: I posted a bug report on the Inkscape bug tracker, hopefully they have time to look into this issue.

https://bugs.launchpad.net/inkscape/+bug/1713450

(1-6/6)