-
Notifications
You must be signed in to change notification settings - Fork 256
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
Screenshot with docker #609
Comments
Hi, It's quite possible, I am using vedo in this way. You need to set everything up for offscreen rendering: there are two main ingredients
(I think it's maybe also possible to use OSMesa offscreen driver directly, but that requires a custom build of VTK as far as I know...) Here is what I am using (NB I am not a docker expert so this is not necessarily optimal or anything...)
FROM python:3.8-slim-bullseye
RUN apt-get update -y \
&& apt-get install libgl1-mesa-dev libgl1-mesa-glx xvfb -y --no-install-recommends \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& rm -rf /var/lib/apt/lists/*
RUN pip install vedo \
&& rm -rf $(pip cache dir)
RUN mkdir -p /app/data
WORKDIR /app/
COPY test.py set_xvfb.sh /app/
ENTRYPOINT ["/app/set_xvfb.sh"]
#!/bin/bash
set -x
export DISPLAY=:99.0
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
#sleep 3
set +x
exec "$@"
from vedo import Sphere, Plotter, settings
settings.screenshotTransparentBackground = True
vp = Plotter(interactive=False, offscreen=True)
s = Sphere(pos=[-5, 0, 0], c="r")
vp.show(s)
vp.screenshot("./data/out.png", scale=2) Then you can
Probably a good idea to set specific versions for your packages etc. in the dockerfile to avoid surprises later if vedo API changes or something. |
@antmatyjajo thanks for the help, but server RAM is not auto-clear when the screenshot function done |
Sure, no problem. |
thank you for your help, I did it, thank you very much, if there is any other problem I will create a new issue :D |
I deploy source with docker, server Linux, have not GPU
Like the title, I want to use a screenshot function to render the mesh texture layer, but not working
is there any way to export images without GPU?
this my source
Linked issue
The text was updated successfully, but these errors were encountered: