☰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

What changed with image_rgba() example?

Community Supportserver
comperem
comperem

Hello,

@p-himik had a clean working example here showing how to rotate a image_rgba glyph.

It worked well with the earlier Bokeh 2 versions but no longer works with Bokeh 2.3.2.

When run as a server application it gives no errors but has only a blank browser screen. No glyphs. Completely blank.

bokeh serve --show rotate_img_example.py

Did something get broken or does this issue have a clear work-around?

Marc

⌁   Link to post
Bryan
Bryan

In fact that example never should have worked at all, since the shape of the image array is wrong:

In [2]: orig_img.shape
Out[2]: (14, 50, 1)

Image arrays have always been expected to be two-dimensional, so this “working” previously was undefined and unexpected (and most importantly: unmaintained) behavior. Singleton dimensions in NumPy arrays can removed by calling the squeeze method on the array before passing it to Bokeh.

⌁   Link to post
comperem
comperem

Ok, right, that’s certainly part of the solution.

Adding the .squeeze() method and adjusting the img_rot.shape to only ask for height and width (ih, iw) allows it to display correctly.

But the rotation algorithm no longer works.

The M matrix is 2x3.

⌁   Link to post
Bryan
Bryan

I’m not sure what this means. When I push the button, I see a rotated (if very pixelated) image. The only change I made was here, at the very last step:

def mk_data(image):
    ih, iw, _ = image.shape
    return dict(image=[image.squeeze()], ....)
⌁   Link to post

End of archived discussion · Replies are disabled