# SVG Export problem

**URL:** https://discourse.processing.org/t/svg-export-problem/42515
**Category:** Coding Questions
**Created:** [July 28, 2023, 7:08pm UTC](https://discourse.processing.org/t/svg-export-problem/42515 "2023-07-28T19:08:09Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![appas](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/appas/32/18810_2.png) [@appas](https://discourse.processing.org/u/appas)
#### Post date: [July 28, 2023, 7:08pm UTC](https://discourse.processing.org/t/svg-export-problem/42515/1 "2023-07-28T19:08:09Z")

</div>

Hello,  
I am trying to export an SVG of an animation frame according to [the instructions in the Reference, section Single Frame from an Animation (With Screen Display)](https://processing.org/reference/libraries/svg/index.html) , but when I press the mouse button to export, I get the error “RuntimeException: No set() for PGraphicsSVG”.  
I found [this topic dealing with the error,](https://discourse.processing.org/t/exporting-barnsley-fern-to-svg/12857) but they work around the problem rather than solve it.

What does this error mean? How do I solve it? I do not have “pixel operations”, such as “set” in my code.

I am running Processing 4.3 on Windows 10 x64.

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [July 29, 2023, 1:19pm UTC](https://discourse.processing.org/t/svg-export-problem/42515/2 "2023-07-29T13:19:12Z")

</div>

Hello @appas.

You will get that error for any of the functions here:

- [processing/java/libraries/svg/src/processing/svg/PGraphicsSVG.java at master · processing/processing · GitHub](https://github.com/processing/processing/blob/master/java/libraries/svg/src/processing/svg/PGraphicsSVG.java#L335)

This prints the exception to console:

```auto
 protected void nope(String function) {
    throw new RuntimeException("No " + function + "() for PGraphicsSVG");
  }

```

The guidelines here may help:

> [@Guidelines—Asking Questions](https://discourse.processing.org/t/guidelines-asking-questions/2147):
>
> Summary (TL;DR) Ask complete questions to get better answers! Be specific. For example: I want to load an image. I tried using createImg() , and I expected the image to be on canvas, but what happened instead was the image showing up below the canvas. Isolate your problem and work in small steps. Share only the code directly related to your problem if it is part of a bigger project, and if something isn’t working, try the smallest code that could do the thing you want. Can we run your code to …

Try to generate a [Minimum, Complete, Verifiable Example](https://stackoverflow.com/help/mcve) as per the guidelines and you may narrow things down.

Start [whittling away](https://www.collinsdictionary.com/dictionary/english/whittle-away) at your code until you just have code that generates the error.

`:)`

---

<div class="post-metadata">

### Author: ![villares](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/villares/32/3166_2.png) [@villares](https://discourse.processing.org/u/villares)
#### Post date: [July 30, 2023, 4:12pm UTC](https://discourse.processing.org/t/svg-export-problem/42515/3 "2023-07-30T16:12:24Z")

</div>

Hi @appas, I think I noticed at some point that you can only export a single SVG per sketch, I don’t remember exactly the reason, and I think it is an awful limitation, but I think this is it. I’ll see if I can gather some reference. A code sample of what you are doing will help people help you.

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [July 30, 2023, 8:53pm UTC](https://discourse.processing.org/t/svg-export-problem/42515/4 "2023-07-30T20:53:45Z")

</div>

Hello @villares ,

> [@villares](#):
>
> I think I notices at some point that you can only export a single SVG per sketch

From what I glean from the library reference you can only export a single frame at a time; that could be each frame, the last frame or with some control statements for a frame you select.

Reference:  
[https://processing.org/reference/libraries/svg/index.html](https://processing.org/reference/libraries/svg/index.html)

`:)`

---

<div class="post-metadata">

### Author: ![appas](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/appas/32/18810_2.png) [@appas](https://discourse.processing.org/u/appas)
#### Post date: [July 31, 2023, 12:49am UTC](https://discourse.processing.org/t/svg-export-problem/42515/5 "2023-07-31T00:49:23Z")

</div>

It was because I had a raster image as background. Commenting out the `background(bg);` call made SVG export happen.

---

<div class="post-metadata">

### Author: ![villares](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/villares/32/3166_2.png) [@villares](https://discourse.processing.org/u/villares)
#### Post date: [July 31, 2023, 4:56am UTC](https://discourse.processing.org/t/svg-export-problem/42515/6 "2023-07-31T04:56:07Z")

</div>

thanks for the reference @glv!

I don’t recall seeing the `.dispose()` method before, maybe using some `PGraphics` strategy with this can allow multiple exports…
