Interpolation while viewing in-file bitmap image

Bug #1418038 reported by Ilya Flyamer on 2015-02-04
18
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Inkscape
Wishlist
Unassigned

Bug Description

After updating to the latest stable version of inkscape (0.91) from the stable ppa I am getting an issue with viewing files with bitmaps inside svg files (to be more specific, svg files created with matplotlib's imshow; I haven't tested it on any other images). On the older version when I was viewing those images I saw pixels as squares, but now they are being interpolated, and it's very bad for my purposes. If there is a setting to switch this interpolation off, please let me know, otherwise I consider it a bug, because I never intended this interpolation to happen and it is even harmful.
Please see an example image where I see this behaviour in the attachment.

Ilya Flyamer (flyamer) wrote :
su_v (suv-lp) wrote :

Please always include information about OS/platform to the bug description.

You can change the rendering mode of the bitmap images on import, or for SVG files generated by older versions or by third-party tools in 'Object Properties' of the bitmap image (use 'optimizeSpeed' for blocky appearance). The new default 'smooth' mode in 0.91 matches the current understanding of the SVG specifications, and is also used in other SVG renderers when zooming in.

Proposing to link as duplicate to
- Bug #1163449 “Imported bitmap appear blurry when zoomed in”
  https://bugs.launchpad.net/inkscape/+bug/1163449

tags: added: bitmap renderer-cairo
Ilya Flyamer (flyamer) wrote :

Thank you for your comment! My OS is Ubuntu 14.04 x64.

Setting the properties of the object helps (so I guess the bug should be closed?), but is there a way to set this behaviour as default?

su_v (suv-lp) wrote :

> but is there a way to set this behaviour as default?

A default behavior can be set for images which are newly imported into the current document (via Inkscape's GUI).

There is no feature to re-interpret the default rendering mode ('smooth') if 'image-rendering' presentation attribute or style property is unset (the default fallback is defined in the SVG spec), or to override the attribute globally (if 'image-rendering' is set to 'optimizeQuality' for individual images), nor is there a built-in command to add the non-default rendering mode attribute to all images in the current document, or to change it to 'blocky' ('optimizeSpeed') for a selection or for all images in the current document.

su_v (suv-lp) wrote :

<slightly off-topic>
A proposal to add controls for 3 rendering modes (for different types of objects: shapes, text, images) in the document properties (to affect the hole document based on inheritance) was made on the mailing list, but not picked up by the developers:
 http://thread.gmane.org/gmane.comp.graphics.inkscape.devel/42901
</slightly off-topic>

--
replaces comment #5: fix URL

Ilya Flyamer (flyamer) wrote :

OK, I see... That's not good :( Thanks for the clarification. Any chance such an option will be added in later versions?

su_v (suv-lp) wrote :

On 2015-02-04 15:15 (+0100), Ilya Flyamer wrote:
> Any chance such an option will be added in later versions?

Hopefully ;-)

The unification of the image properties and object properties dialogs (bug #1252991) might offer a chance to add interface options to easier adjust the attribute in different scopes (e.g. for all images, or those within selection), and the new 'antialiasing' rendering mode as currently implemented in document properties is at an early stage AFAICT (the renderer needs more work, and along with that the user interface for such rendering options might get discussed once again - to support setting the attribute on object as well as on document level).

Ilya Flyamer (flyamer) wrote :

Well, what would be the best for me is an option to switch off the "antialiasing" completely for all images ever, unless I ask for it specifically in a document/for an object/etc.
I understand the SVG specs state it should be like that, but if I am importing a bitmap image I want it to be visible the way it really is and not be smoothed by the software I am using without any specific "request" from me. For me each pixel in the image represents a data point, and its smoothing only hides the details in a picture and makes it more difficult for the eyes.

Attaching initial version of custom extension to set image-rendering
properties of <image> elements in various scopes, to be used with
Inkscape SVG files created with earlier Inkscape versions, or with SVG
files created by third-party applications.

Needs more testing, and ideally would be replaced by internal features
with options in the GUI (per-object, and on document level).

The extension, once installed, can be accessed via menu
 Extensions > Images > Set image rendering quality

Known issues:
* Inkscape's renderer apparently doesn't refresh the content properly
when applied to the test case attached in this report - open a duplicate
window (menu 'View') or import the SVG file into a new document before
running the extension (as workaround).

--
sources are also available at
http://bazaar.launchpad.net/~suv-lp/+junk/inkscape-extensions/files/head:/images/

Ilya Flyamer (flyamer) wrote :

Dear ~suv,
Thank you for the extension, it seems to be working, but for some reason the time it takes to set the property is much longer, than if I manually select the image and change the property to optimizeSpeed: the latter works instantaneously, but the former feels like it requires at least 5 seconds.

su_v (suv-lp) wrote :

For files with a single bitmap image, the extension is unlikely to speed up setting the attribute - for other use cases (e.g. files with several images, or with image masks hidden in the <defs> section) it might help to be able to set the property on SVG root itself, or in one of the other scopes.

su_v (suv-lp) wrote :

Confirming - being able to adjust the rendering mode of bitmap images apart from the import setting, and the object properties of an individual bitmap image, would be a useful feature (internally, or as extension).

Changed in inkscape:
importance: Undecided → Wishlist
status: New → Confirmed
Ilya Flyamer (flyamer) wrote :

Thanks for help and understanding, ~suv!

su_v (suv-lp) wrote :

The extension from comment #10 was combined with the extension to set the attribute 'preserveAspectRatio' for bitmap images (see bug #1357808 for details) and committed to trunk in r14164.

Not closing this report yet (see comment 6, 8 for possible future GUI options).

Dirk Boonzajer Flaes (dboonz) wrote :

I found another workaround for now. If in matplotlib you set the interpolation to 'nearest' instead of 'none', it is correctly imported in inkscape.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers