ipyplot icon indicating copy to clipboard operation
ipyplot copied to clipboard

[Feature Request] Save resulting grid of images

Open marianatuma opened this issue 5 years ago • 3 comments

Is it possible to save the result of ipyplot.plot_images( ) via python code? If not, I think that would be a useful feature to have.

marianatuma avatar Oct 28 '20 17:10 marianatuma

Hi @marianatuma Currently there's no easy way to do it. You can export HTML that created the plot but that's it.
I did some research in that area and to convert HTML to images in python I would need to rely on something like imgkit which depends on some external tools as well. I will think about it and run some experiments

karolzak avatar Nov 03 '20 19:11 karolzak

Similar/duplicate issue #14 but let's keep the thread going here since it went a bit in a different direction there

karolzak avatar Nov 03 '20 19:11 karolzak

Is it possible to save the result of ipyplot.plot_images( ) via python code? If not, I think that would be a useful feature to have.

I've managed to save the generated HTML like this. As per saving the output directly to an image, this might be helpful https://gist.github.com/aspose-com-gists/2741bb268101fd3e5ec74a860abf717b

  1. In ipyplot __plotting.py
# ipyplot.__plotting
def plot_images(...)
      ...
      html = _create_imgs_grid(...)
      return html
  1. html = ipyplot.plot_images(...)
html = ipyplot.plot_images(...)
with open('view.html', 'w') as fin:
    fin.write(html)

arazvant avatar Dec 22 '22 12:12 arazvant