☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

SaveTool() bug when an image is overlayed on the graph using p.image_url()

Community Support
1111
1111

Hi!

A couple of days ago I asked about plotting an image on a figure.

So now that I’ve done that using p.image_url(url=‘url’, source=source, etc…) my SavingTool() does not download the image whenever I click the Save icon.

Whenever I comment out the image and run the code again the savingtool works fine.

⌁   Link to post
Bryan
Bryan

Can you provide a complete minimal example code to reproduce the problem? It's not really possibly to investigate or say anything specific without being able to see/run code.

Thanks,

Bryan

···

On Jan 5, 2017, at 10:05 AM, Hi <joris.bekkers@gmail.com> wrote:

Hi!

A couple of days ago I asked about plotting an image on a figure.

So now that I've done that using p.image_url(url='url', source=source, etc..) my SavingTool() does not download the image whenever I click the Save icon.

Whenever I comment out the image and run the code again the savingtool works fine.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/ca1a629a-4ea5-4e8c-a5c7-37d96fac7a7d%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

⌁   Link to post
1111
1111

Sorry for not doing that right away!

Here you go:

from bokeh.plotting import figure
from bokeh.models import SaveTool
from bokeh.models import ColumnDataSource
from bokeh.io import show

url = ‘http://bokeh.pydata.org/en/latest/_static/images/logo.png’

source = ColumnDataSource(data=dict(
x=,
y=,
url= [url]))

TOOLS = [SaveTool()]

p = figure(plot_height=500, plot_width=500, tools=TOOLS,
title=“Save Tool Plot”, logo=None)

l0 = p.square(x=“x”,
y=“y”,
source=source,
alpha=0.6,
)

p.image_url(url=‘url’,x=.75,y=.45,h=.20,w=.20, source=source)

def update():

source.data = dict(
x=[.9],
y=[.5],
url=[url]
#color=df[‘color’]
)

sizing_mode = ‘fixed’

update()

show(p)

⌁   Link to post
Bryan
Bryan

Hi,

So your code for me works in Safari, but not in Chrome. In Crome I see this error message in the JS console:

  Uncaught DOMException: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported.

A google search turns up this StackOverflow discussion:

  http://stackoverflow.com/questions/22710627/tainted-canvases-may-not-be-exported

which suggests that this is ultimately a cross-domain issue. My guess is that if you host your output and the image URLs that you want to load on the same domain, then things will work. Unfortunately we do not have any leverage or control over how browsers implement their security policies, so I am not sure there is anything I can suggest other than:

* try a different browser
* convert the images you need to RGBA numpy arrays and use image_rgba instead

Thanks,

Bryan

···

On Jan 6, 2017, at 2:01 AM, joris.bekkers@gmail.com wrote:

Sorry for not doing that right away!

Here you go:

from bokeh.plotting import figure
from bokeh.models import SaveTool
from bokeh.models import ColumnDataSource
from bokeh.io import show

url = 'http://bokeh.pydata.org/en/latest/_static/images/logo.png&#39;

source = ColumnDataSource(data=dict(
x=,
y=,
url= [url]))

TOOLS = [SaveTool()]

p = figure(plot_height=500, plot_width=500, tools=TOOLS,
title="Save Tool Plot", logo=None)

l0 = p.square(x="x",
y="y",
source=source,
alpha=0.6,
)

p.image_url(url='url',x=.75,y=.45,h=.20,w=.20, source=source)

def update():

source.data = dict(
x=[.9],
y=[.5],
url=[url]
#color=df['color']
)

sizing_mode = 'fixed'

update()

show(p)

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/6dfe0e35-dbcf-46d9-8050-48396a3271ae%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

⌁   Link to post

End of archived discussion · Replies are disabled