Comment 0 for bug 1357808

Revision history for this message
su_v (suv-lp) wrote : trunk: add extension to fix rendering of non-uniformly scaled bitmap images

Follow-up report to
- Bug #616717 “Resized bitmap images are rendered differently by Firefox or Batik ('preserveAspectRatio' attribute not set)”
  <https://bugs.launchpad.net/inkscape/+bug/616717>
- Bug #461467 “Image scale saved incorrectly (preserveAspectRatio)”
  <https://bugs.launchpad.net/inkscape/+bug/461467>

The fix in current trunk to correctly set the attribute 'preserveAspectRatio' for bitmap images to 'none', and to respect that attribute for rendering, may break Inkscape documents with embedded or linked bitmap images which had been created with current stable and older versions of Inkscape. It often also affects older Inkscape documents based on imports of file formats like PS/EPS/PDF - such SVG documents often use structures with non-uniformly scaled bitmap images masked by equally scaled bitmap images).

The attached extension allows to add the attribute to selected or all bitmap images in the current document (including bitmap images used as masks, which are stored in the <defs> section). This could serve as workaround until Inkscape has an extended GUI for such attributes (see e.g. bug #1252991).

Please review and test - this was written quickly and not thoroughly tested (a better fix of course would be if Inkscape had an internal feature (with GUI) to set/unset such attributes for <image> elements).