Skip to content

svgEditor.svgCanvas.rasterExport("PNG", 100) does not include images - ReOpen - #2 #1007

@alexm7

Description

@alexm7

Describe the bug
I reported the issue in #1002 and #1003 seemed to have resolved it. However a new "git clone" does not work to allow this code to work:
svgEditor.svgCanvas.rasterExport("PNG", 100)
It will create the export of just the SVG tags.
However an svg tag will not be included

To Reproduce
Steps to reproduce the behavior:

  1. Menu > Open
  2. Open this SVG file as an example:
<svg width="840" height="1269" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
 <g class="layer">
  <title>Layer 1</title>
  <image height="1269" href="https://apod.nasa.gov/apod/image/2411/earthset-snap00.png" id="svg_1" width="840"/>
 </g>
</svg>
  1. This should show the image, if it does not then you need to add "href" tags to the svgedit/packages/svgcanvas/core/santize.js (line 51)
  2. Rebuild
  3. reload from step 2 above.
  4. Add a couple of SVG objects (lines or whatever)
    Then test the export:
  5. Menu > Export
  6. This should show the background image and the tags all composited onto a single PNG image. However this does not work, it only shows the SVG elements that are NOT the image. This is the broken part.

Expected behavior
Menu > Export should generate a PNG image with all the SVG tag content (images and other tags).

*SVG-Edit environment (IMPORTANT)

  • Version: current version from "git clone"

Desktop (please complete the following information):

  • OS: Linux (same on any OS)
  • Browser firefox (same on any browser)

Log
Here is the output in the Firefox javascript "Console" that shows the error:
image

Additional context
Weird thing is that this worked when #1003 was fixed. But not it stopped working on a new git clone.
Please let me know if I can help with any other details.
Thanks!
Alex.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions