On Saturday, 14 November 2020 12:21:40 PST Dima Kogan wrote:
> Hi.
>
> I'm seeing that currently our svg output produces blurred images. I'm
> attaching a patch to (sorta) fix this.
>
> Demo script:
>
> set terminal svg standalone
> set output "/tmp/tst.svg"
> set view map
> splot [0:10][0:10] '++' using 1:2:($1+$2) with image
>
> The images before and after the patch are attached. Using firefox, you
> can see the before-patch image containing smoothed pixels, while the
> after-patch image contains pixels with crisp edges, which is what we
> want I think.
My feeling is that we should not even try to track browser-specific quirks.
We already have an options to guarantee those crisp edges that so
far as I know works on all platforms and viewers:
gnuplot> help pixels
Some terminals use device- or library-specific optimizations to render image
data within a rectangular 2D area. This sometimes produces undesirable output,
e.g. bad clipping or scaling, missing edges. The `pixels` keyword tells
gnuplot to use generic code that renders the image pixel-by-pixel instead.
This rendering mode is slower and may result in much larger output files, but
should produce a consistent rendered view on all terminals.
Example:
plot 'data' with image pixels
See also the 4th plot in
http://gnuplot.sourceforge.net/demo_svg/heatmaps.html
> Unfortunate caveat: apparently firefox and chrome can't agree on what to
> call this property. Firefox wants "crisp-edges" to do this, while Chrome
> wants "pixelated". So today, this patch will do the right thing on
> Firefox, but not on Chrome. Anybody know how to make this work on both
> (and the others, I guess)?
>
> I'm on the fence about whether patching gnuplot to work with just one of
> the two is better than keeping them both blurry in the same way.
Better to fix it at the stage of image generation than to try to
figure out browser-specific fixes. And it could well be that for
some applications the smoothed version is preferable to the pixelated one.
You have the choice of adding the "pixels" keyword or not.
Ethan
|