Skip to content

Saving plots as images not working #43

@fzaiser

Description

@fzaiser

Trying an example from the documentation:

Plot.dot([[1, 1]]).save_image("basic_plot.png", width=800, height=600)

I get an error:

Old Headless mode has been removed from the Chrome binary. Please use the new Headless mode (https://developer.chrome.com/docs/chromium/new-headless) or the chrome-headless-shell which is a standalone implementation of the old Headless mode (https://developer.chrome.com/blog/chrome-headless-shell).
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
Cell In[20], line 1
----> 1 Plot.dot([[1, 1]]).save_image("basic_plot.png", width=800, height=600)

File [redacted]/.venv/lib/python3.12/site-packages/genstudio/layout.py:200, in LayoutItem.save_image(self, path, width, height)
    195 hti.screenshot(
    196     html_str=html_standalone(self.for_json()), save_as=os.path.basename(path)
    197 )
    199 # Crop transparent regions
--> 200 img = Image.open(path)
    201 img = img.crop(img.getbbox())
    202 img.save(path)

File [redacted]/.venv/lib/python3.12/site-packages/PIL/Image.py:3431, in open(fp, mode, formats)
   3428     filename = os.path.realpath(os.fspath(fp))
   3430 if filename:
-> 3431     fp = builtins.open(filename, "rb")
   3432     exclusive_fp = True
   3433 else:

FileNotFoundError: [Errno 2] No such file or directory: '[redacted]/basic_plot.png'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions