bugGNU Octave - Bugs: bug #38323, printing image to svg uses same...


bug #38323: printing image to svg uses same embedded png filename with gnuplot 4.6

Submitted by:  None
Submitted on:  Wed 13 Feb 2013 09:06:46 AM UTC  
Category: Plotting with gnuplotSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: Patch SubmittedAssigned to: None
Originator Name: Daniel KottkeOriginator Email: -unavailable-
Open/Closed: OpenRelease: dev
Operating System: Any

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

Please log in, so followups can be emailed to you.


(Jump to the original submission Jump to the original submission)

Tue 24 May 2016 03:31:28 AM UTC, comment #15:

There has been a feature update to gnuplot development version. A version of SVG files with embedded PNG images can be obtained by using the terminal option "standalone". This is better approach than using "failsafe" in the plot command.

For quite some time there has been an option "standalone" for svg terminal in gnuplot, but it only applied to the mouse reference. For the development version the option 'standalone' also applies to image data. Without the standalone option, there will be external reference.

So, given the precedence of both gnuplot and Octave convention my suggestion is

1) Keep the Octave "svg" print device as it is, but place the referenced auxiliary PNG file in the same directory as the SVG image.

2) Introduce a new device "svgstandalone" that embeds the image within the SVG file. This is very consistent nomenclature with other devices.

Does that seem consistent with other device behavior?

Dan Sebald <sebald>
Thu 12 May 2016 08:21:42 PM UTC, comment #14:

Ok, thanks, so you have answered my question, we have to use the keyword "failsafe" for older versions of gnuplot.

Where the png file is written is irrelevant, Octave users expect the output of print to be a single svg file, not a pair of files that need to be copied around. And printing more than once produces different svg files that reference the same png file name. This is a completely non-usable feature.

If you want to work with gnuplot to introduce a new option for a future version of gnuplot, please do so, but Octave still needs a patch to produce a single svg file with the "failsafe" keyword with gnuplot 4.6.

Mike Miller <mtmiller>
Project Member
Thu 12 May 2016 08:03:47 PM UTC, comment #13:

I'm thinking a new option for gnuplot. One that can, if possible, make the default a standalone SVG file; then have an option that splits out PNG. I would prefer to not even introduce the term "failsafe" to the Octave scripts.

If there were a way to make Octave place that split-PNG file in the same directory as the SVG destination, that would be an incremental "bug fix".

I'll follow up with more on the possible gnuplot SVG term option.

Dan Sebald <sebald>
Thu 12 May 2016 07:48:40 PM UTC, comment #12:

For clarity, are you talking about a new option that would be in the svg terminal in gnuplot version 5.1 or 5.2? Or are you asking about an option that may have been in the svg terminal since gnuplot version 4.4 but we didn't know about it?

I'm asking because we will still need to support old gnuplot versions, so even if something is fixed in a future version, if we have to use "failsafe" in gnuplot 4 then we have to support that (yes, conditional on the svg terminal).

Mike Miller <mtmiller>
Project Member
Thu 12 May 2016 07:21:29 PM UTC, comment #11:

The answer in the gnuplot bug report is pretty much in synch with observations here. I'm not crazy about that solution of "failsafe" though. I'd say to condition its inclusion on "svg" because it might cause suboptimal behavior on other gnuplot terminals (e.g., postscript where instead of an image one will get individual pixels).

I'm going to inquire at that bug report if we can instead add a gnuplot option to the SVG terminal that will keep all data within the single file. (I think there is somewhere in the Octave gnuplot scripts where options for individual terminals is handled so it would be an easy change there.)

Dan Sebald <sebald>
Thu 12 May 2016 05:21:30 PM UTC, comment #10:

I'm adding Daniel Sebald to the CC list since he knows a lot about gnuplot and might be able to say whether the change in comment #9 is acceptable. Is the 'failsafe' keyword available in all versions of gnuplot, or only in modern ones? It might require modifying the _gnuplot_has_feature_.m script.

Rik <rik5>
Project Administrator
Thu 12 May 2016 03:28:27 AM UTC, comment #9:

As shown in this gnuplot bug report:


I made the following change in Octave:

In short, adding the keyword "failsafe" to the "with image" command.

This created a much larger svg file without the embedded png file. The svg image loads fine in eog and firefox.

No idea if this change is safe for all terminals or if logic needs to be added to apply it only to the svg terminal.

Mike Miller <mtmiller>
Project Member
Sun 28 Feb 2016 04:16:13 PM UTC, comment #8:

Still present (2/28/16). This is with gnuplot 5.0

Rik <rik5>
Project Administrator
Wed 13 Feb 2013 05:53:07 PM UTC, comment #7:

I can reproduce OPs problem with gnuplot 4.6. Works fine with gnuplot 4.4 because there is no png file. Apparently this is a new feature that makes the svg file smaller by embedding an external png.

A similar problem with this approach is if you print two or more different images to svg, the embedded png file will always have the same filename, gp_image_01.png, overwriting any previous plot saves.

This seems to me like unexpected, unscalable, and backwards-incompatible behavior. I'd be in favor of bypassing this feature of gnuplot if at all possible.

Regarding fltk, is this not already reported as bug #37753? Let's keep this one strictly about this gnuplot problem.

Mike Miller <mtmiller>
Project Member
Wed 13 Feb 2013 03:20:25 PM UTC, comment #6:

Ah, you're using gnuplot. I'm not. That's why the image is named "gp_"

I'm retitling this bug to reflect the actual problem.

Jordi Gutiérrez Hermoso <jordigh>
Project Administrator
Wed 13 Feb 2013 03:00:50 PM UTC, comment #5:

It is always named: 'gp_image_01.png' and its in the current octave directory. So in the folder you started octave.

Wed 13 Feb 2013 02:56:44 PM UTC, comment #4:

I don't see a png image at all. What is the name, where are you seeing it?

Jordi Gutiérrez Hermoso <jordigh>
Project Administrator
Wed 13 Feb 2013 02:55:09 PM UTC, comment #3:

No, it does include the image (it creates a png-file in your working directory and includes it as embedded-png in the svg file. if your svg is in your working directory, it should work). I found out that a problem is, that octave always uses the same name for the underlaying png. This is why, all your background images look the same in every svg-file, if you do many plots for different situations (that is the real bug of this thread).

To relate to original post: The problem with plotting in a different folder is due to the backgound-png, that is put into the working directory.

Wed 13 Feb 2013 02:38:37 PM UTC, comment #2:

As far as I can tell, the subdirectory thing is absolutely irrelevant. The issue is that the svg plot doesn't include the image, only the points in the plot. Can you confirm?

Jordi Gutiérrez Hermoso <jordigh>
Project Administrator
Wed 13 Feb 2013 09:25:38 AM UTC, comment #1:

I just found out, that that the reason is a png-file that lies under the svg. This is put into the working folder, and overwriten erverytime, you create a new svg.

I would be good, to name this png like the original svg+suffix and to put it in the same folder.

Wed 13 Feb 2013 09:06:46 AM UTC, original submission:

Hello everyone,

when printing a plot created by imshow and plot, there are different results. When printing into a folder, the previously plotted image is missing and just the points show up. See code:



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

Attach File(s):

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by sebald (Posted a comment)
  • -unavailable- added by rik5
  • -unavailable- added by mtmiller (Posted a comment)
  • -unavailable- added by jordigh (Posted a comment)
  • -unavailable- added by None (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 11 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 25 May 2016 05:06:41 AM UTCrik5Carbon-CopyRemoved 72865=>-
    Thu 12 May 2016 05:21:30 PM UTCrik5Carbon-Copy-=>Added sebald
    Thu 12 May 2016 03:28:27 AM UTCmtmillerStatusConfirmed=>Patch Submitted
    Thu 04 Jun 2015 02:05:25 AM UTCmtmillerItem GroupInaccurate Result=>Incorrect Result
      Operating SystemGNU/Linux=>Any
    Wed 13 Feb 2013 05:53:07 PM UTCmtmillerCategoryPlotting=>Plotting with gnuplot
      Summary embedded png in svg missing in fltk when printing; always same png filename with gnuplo=>printing image to svg uses same embedded png filename with gnuplot 4.6
    Wed 13 Feb 2013 03:20:25 PM UTCjordighStatusNeed Info=>Confirmed
      SummaryMissing image when printing in folder=> embedded png in svg missing in fltk when printing; always same png filename with gnuplo
    Wed 13 Feb 2013 02:38:37 PM UTCjordighStatusNone=>Need Info

    Back to the top

    Powered by Savane 3.1-cleanup