Skip to content

Saving plots as images not working #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
fzaiser opened this issue Feb 10, 2025 · 0 comments
Open

Saving plots as images not working #43

fzaiser opened this issue Feb 10, 2025 · 0 comments

Comments

@fzaiser
Copy link

fzaiser commented Feb 10, 2025

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'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant