bugGNU Octave - Bugs: bug #62998, Hint SVG renderers to not...

 
 

bug #62998: Hint SVG renderers to not interpolate images

Submitter:  Pantxo Diribarne <pantxo>
Submitted:  Thu 01 Sep 2022 08:32:06 PM UTC
   
 
Category:  Plotting with OpenGL Severity:  1 - Wish
Priority:  5 - Normal Item Group:  Feature Request
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sat 15 Apr 2023 09:11:41 AM UTC, comment #10: 

Thanks Rik. Indeed, svg images still render blurred on some viewers but this is a downstream bug.

Closing report.

Pantxo Diribarne <pantxo>
Group Member
Wed 12 Apr 2023 09:03:49 PM UTC, comment #9: 

@pantxo: patch was pushed back in September, 2022.  Is this bug okay to close?

Rik <rik5>
Group administrator
Mon 07 Nov 2022 05:46:11 PM UTC, comment #8: 

Yes indeed, I was sure I had tested in chromium but I tested today in Crome on Windows and confirmed that the SVG produced by the code in comment #6 and Ocatve 8 was rendered blurred, as it did with Octave 7. Changing "optimizeSpeed" to "crisp-edges" (the css corresponding value) still renders correctly (i.e. non-interpolated) in Firefox but blurred in Chrome so this is not a solution.

Pantxo Diribarne <pantxo>
Group Member
Sat 05 Nov 2022 01:00:04 AM UTC, comment #7: 

I still see a blurred image in GNU Octave Version: 8.0.0 (hg id: 7781b1e77406) in chrome (107.0.5304.87), but non-blured
in firefox (105.0.2) and inkview.

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Sat 29 Oct 2022 07:41:32 PM UTC, comment #6: 

I tested in Firefox, chromium and Inkscape/Inkview with the following image:


imagesc (rand (5))
print toto.svg


I attached screenshots of this file before (Octave7.png) and after the patch (Octave8.png) as rendered by Inkview.


Pantxo Diribarne <pantxo>
Group Member
Thu 27 Oct 2022 07:34:00 AM UTC, comment #5: 

Do you have any steps that can be used to test if this is working as expected now?

Markus Mützel <mmuetzel>
Group administrator
Thu 15 Sep 2022 07:36:21 PM UTC, comment #4: 

I pushed the patch here:

http://hg.savannah.gnu.org/hgweb/octave/rev/4c1be4d6d0d1

Marking ready for test.

Pantxo Diribarne <pantxo>
Group Member
Mon 05 Sep 2022 04:50:55 PM UTC, comment #3: 

I think there are two independent approaches which are using the SVG image element "image-rendering" property [1] or using its CSS replacement [2]. The current specification for SVG still lists the old possible values for "image-rendering" but says the following:


The CSS Image Values and Replacement Content Module Level 4 may in the future redefine this property. In particular it should allow the choice between smoothing and keeping a pixelated look when upscaling.


So AFAIU the first still does not supersede the second.

I'll push the patch with the SVG value ("optimzeSpeed") and hope that, as you say, it is actually interpreted as "cripEdges" (what we want) in modern viewers. 

[1] https://www.w3.org/TR/SVG/painting.html#ImageRenderingProperty
[2] http://dev.w3.org/csswg/css-images/#the-image-rendering

Pantxo Diribarne <pantxo>
Group Member
Fri 02 Sep 2022 09:28:57 AM UTC, comment #2: 

At first, I thought this was an odd name for what we want.
But reading what will probably be part of an updated standard, I agree that this is exactly what we'd probably want:
https://drafts.csswg.org/css-images/#the-image-rendering

> This property previously accepted the values optimizeSpeed and optimizeQuality. These are now deprecated; a user agent must accept them as valid values but must treat them as having the same behavior as crisp-edges and smooth respectively, and authors must not use them.


IIUC, on renderers that support the newer standard, "optimizeSpeed" equates to "crisp-edges". That is what we want IIUC. And the keyword from the older standard is probably better supported by more renderers out there.
Not sure though what the last part of that section ("authors must not use them") refers to and how imperative it really is...

Nit: Small typo in the commit message "optimizedSpeed" -> "optimizeSpeed".

Looks good to me.

Markus Mützel <mmuetzel>
Group administrator
Thu 01 Sep 2022 08:37:18 PM UTC, comment #1: 

I attached a patch for octave-svgconvert.cc.

(file #53648)

Pantxo Diribarne <pantxo>
Group Member
Thu 01 Sep 2022 08:32:06 PM UTC, original submission:  

Currently Octave's SVG printout doesn't specify the "image-rendering" attribute for image elements [1] and thus rendering engines like Firefox and Inkscape pick the default value "auto" which interpolates images when scaling.

I checked that changing that value to "optmizedSpeed" disables interpolation at least again in Firefox and Inkscape. See the attached two SVG files.
 
[1] https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/image-rendering

Pantxo Diribarne <pantxo>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #53921:  Octave7.png added by pantxo (63KiB - image/png)
file #53922:  Octave8.png added by pantxo (8KiB - image/png)
file #53648:  bug62998.patch added by pantxo (1KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by dasergatskov (Posted a comment)
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by pantxo (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-04-15 pantxo StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2022-10-29 pantxo Attached File- Added Octave7.png, #53921
        Attached File- Added Octave8.png, #53922
    2022-09-15 pantxo StatusPatch Reviewed Ready For Test
    2022-09-02 mmuetzel StatusPatch Submitted Patch Reviewed
    2022-09-01 pantxo Attached File- Added bug62998.patch, #53648
        StatusNone Patch Submitted

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code