|
From: Ethan A M. <me...@uw...> - 2023-06-18 05:41:37
|
> The svg terminal currently produces images with no image-rendering > annotations. And most browsers render images with bilinear interpolation > by default, which makes low-res images look very wrong. > My friend figured out how to get svg to work > in both firefox and chrome, and I'm attaching a patch that does that. > The description is in the patch. [snip patch that adds attributes <image image-rendering='crisp-edges' style='image-rendering: pixelated' ... ] Thanks. That's a good start. As tested here those attributes are indeed honored by firefox and chrome. Mixed success on other svg handling programs. Works: chrome firefox inkscape/inkview ImageMagick Fails: konqueror LibreOffice / soffice gwenview gimp Unknown (did not try): eog geeqie Ethan |
|
From: Dima K. <gn...@di...> - 2023-06-19 06:58:54
|
Ethan A Merritt <me...@uw...> writes: > As tested here those attributes are indeed honored by firefox and chrome. > Mixed success on other svg handling programs. I'm guessing that adding support for either image-rendering=crips-edge or image-rendering=pixelated into librsvg and QSvg would make all of these work. But it looks like these two libraries simply don't support either option yet. I'll file feature-request bug reports for those two projects. But the patch should probably still go in: supporting firefox and chrome is much better than supporting nothing. |
|
From: Ethan A M. <me...@uw...> - 2023-06-19 07:36:48
|
On Sunday, 18 June 2023 23:55:07 PDT Dima Kogan wrote:
> Ethan A Merritt <me...@uw...> writes:
>
> > As tested here those attributes are indeed honored by firefox and chrome.
> > Mixed success on other svg handling programs.
>
> I'm guessing that adding support for either image-rendering=crips-edge
> or image-rendering=pixelated into librsvg and QSvg would make all of
> these work. But it looks like these two libraries simply don't support
> either option yet.
I looked into it a bit further.
The thing is, the two hinting properties you found are not part of the
SVG standard (version 2). They are instead CSS style hints to the browser.
Chrome and Firefox apparently dive into an included SVG file and extract
the CSS style hints from there. SVG-aware programs that are not browsers,
like inkscape or gimp, could do the same but the motivation for doing
so would come from imitating Chrome or Firefox rather than adhering to
the SVG standard. Inkscape does, but gimp doesn't.
> I'll file feature-request bug reports for those two projects.
> But the patch should probably still go in: supporting firefox and chrome
> is much better than supporting nothing.
For me personally, the support from inkscape is just as important as
from the browsers. I use it to prepare figures for publication.
And it's still true that you can work around this
by using "with image pixels" for gnuplot heat maps.
What about lobbying the SVG working group to add an equivalent
to the SVG spec? All the various support libraries would then
eventually fall in line. As of SVG 2.0 you only get a choice
between "optimizeSpeed" and "optimizeQuality", both of which
are so vague as to be useless for our purpose.
https://svgwg.org/svg2-draft/painting.html#ImageRendering
|
|
From: Dima K. <gn...@di...> - 2023-06-19 22:48:19
|
Ethan A Merritt <me...@uw...> writes: > I looked into it a bit further. > > The thing is, the two hinting properties you found are not part of the > SVG standard (version 2). They are instead CSS style hints to the browser. > Chrome and Firefox apparently dive into an included SVG file and extract > the CSS style hints from there. SVG-aware programs that are not browsers, > like inkscape or gimp, could do the same but the motivation for doing > so would come from imitating Chrome or Firefox rather than adhering to > the SVG standard. Inkscape does, but gimp doesn't. > >> I'll file feature-request bug reports for those two projects. >> But the patch should probably still go in: supporting firefox and chrome >> is much better than supporting nothing. > For me personally, the support from inkscape is just as important as > from the browsers. I use it to prepare figures for publication. > And it's still true that you can work around this > by using "with image pixels" for gnuplot heat maps. > > What about lobbying the SVG working group to add an equivalent > to the SVG spec? All the various support libraries would then > eventually fall in line. As of SVG 2.0 you only get a choice > between "optimizeSpeed" and "optimizeQuality", both of which > are so vague as to be useless for our purpose. > > https://svgwg.org/svg2-draft/painting.html#ImageRendering That's interesting. Not sure what it means for us in practical terms. The patch in this thread should cover most browsers. Most non-browser applications I've seen use rsvg: bug report here https://gitlab.gnome.org/GNOME/librsvg/-/issues/985 I guess QT has its own implementation too; I ran out of steam, and haven't pestered them. I don't know what libreoffice does, but it does the right thing on my machine. And I don't know how to lobby the SVG working group. I would merge the patch in this thread, maybe file a bug report against QSvg, and move on. |
|
From: Dima K. <gn...@di...> - 2023-07-13 16:28:47
|
Dima Kogan <gn...@di...> writes: > Most non-browser applications I've seen use rsvg: bug report here > > https://gitlab.gnome.org/GNOME/librsvg/-/issues/985 Just an FYI. The rsvg upstream has fixed the issue, and closed the bug report (allegedly; I couldn't easily try it). But if it's fixed, then most non-browser client applications will show our pixelated images. |
|
From: Ethan A M. <me...@uw...> - 2023-07-13 19:18:33
|
On Thursday, 13 July 2023 09:26:25 PDT Dima Kogan wrote: > Dima Kogan <gn...@di...> writes: > > > Most non-browser applications I've seen use rsvg: bug report here > > > > https://urldefense.com/v3/__https://gitlab.gnome.org/GNOME/librsvg/-/issues/985__;!!K-Hz7m0Vt54!k39HeEQ9zt5kuFFtV54jBNfoBJvfqILRmzHarDU6bxyPm-2JXE1ruwmzZkCnARQ0hIggFA3zaJa59Jm0EojHJg$ > > Just an FYI. The rsvg upstream has fixed the issue, and closed the bug > report (allegedly; I couldn't easily try it). But if it's fixed, then > most non-browser client applications will show our pixelated images. Except, apparently, on MacOS. See discussion on https://sourceforge.net/p/gnuplot/feature-requests/558/ https://www.userlandia.com/home/2021/11/the-mystery-of-mac-os-mangled-image-interpolation-implementation I'm in the process of combining suggestions from Hiroki Motoyoshi (problems with MacOS) and Alexander Täschner (problems with MSVC) to hopefully end up with something that works for everyone. thanks Ethan |