html2image icon indicating copy to clipboard operation
html2image copied to clipboard

Simple Test Fails

Open DS256 opened this issue 4 months ago • 2 comments

I'm running in a Python 3.11.2 in a Virtual Environment on Raspberry PI Bookworm.

My HTM2IMAGE code recently stopped working after an RP OS update/upgrade.

I've created the following simple stand-alone representation of my code and it does not produce any output.

Looking for things I'm doing wrong

Thanks

from html2image import Html2Image

hti = Html2Image(size=(640, 340),\
                 custom_flags=['--quiet'],\
                 disable_logging=True,\
                 output_path=".")

css = 'body {background: rgb(204,204,204)}; }'				# Match other graph colour

hti.screenshot(html_file="html2image.html", css_str=css, save_as="t.jpg")			# Convert HTML to JPG


DS256 avatar Aug 23 '25 21:08 DS256

I noticed that my test code surpressed logs and errors so I remove these parms and reran the tests which produced errors. Again, this was working before the last update of RPI OS.

(wc2) pi@wethCAM:/media/work/photos $ cat test1.py
from html2image import Html2Image

hti = Html2Image(size=(640, 340),\
                 output_path=".") 					# Trial and error for 640x200
                                                            # V8.8 had to increase to 640x340
                                                            
css = 'body {background: rgb(204,204,204)}; }'				# Match other graph colour

hti.screenshot(html_file="html2image.html", css_str=css, save_as="hti.jpg")	# Convert HTML to JPG

(wc2) pi@wethCAM:/media/work/photos $ 

Reported errors that I have no idea how to decipher

(wc2) pi@wethCAM:/media/work/photos $ [4434:4434:0100/000000.776123:ERROR:ui/gl/angle_platform_impl.cc:47] Display.cpp:1089 (initialize): ANGLE Display::initialize error 12289: Could not open the default X display.
ERR: Display.cpp:1089 (initialize): ANGLE Display::initialize error 12289: Could not open the default X display.
[4434:4434:0100/000000.782110:ERROR:ui/gl/egl_util.cc:92] EGL Driver message (Critical) eglInitialize: Could not open the default X display.
[4434:4434:0100/000000.788468:ERROR:ui/gl/gl_display.cc:640] eglInitialize OpenGLES failed with error EGL_NOT_INITIALIZED
[4434:4434:0100/000000.788738:ERROR:ui/gl/gl_display.cc:675] Initialization of all EGL display types failed.
[4434:4434:0100/000000.788843:ERROR:ui/ozone/common/gl_ozone_egl.cc:26] GLDisplayEGL::Initialize failed.
[4434:4434:0100/000000.876247:ERROR:ui/gl/angle_platform_impl.cc:47] Display.cpp:1089 (initialize): ANGLE Display::initialize error 12289: Could not open the default X display.
ERR: Display.cpp:1089 (initialize): ANGLE Display::initialize error 12289: Could not open the default X display.
[4434:4434:0100/000000.876554:ERROR:ui/gl/egl_util.cc:92] EGL Driver message (Critical) eglInitialize: Could not open the default X display.
[4434:4434:0100/000000.876667:ERROR:ui/gl/gl_display.cc:640] eglInitialize OpenGLES failed with error EGL_NOT_INITIALIZED
[4434:4434:0100/000000.876762:ERROR:ui/gl/gl_display.cc:675] Initialization of all EGL display types failed.
[4434:4434:0100/000000.876952:ERROR:ui/ozone/common/gl_ozone_egl.cc:26] GLDisplayEGL::Initialize failed.

(wc2) pi@wethCAM:/media/work/photos $

DS256 avatar Aug 24 '25 13:08 DS256

The above problems were with html2image 2.0.4.3. Thinking a newer version would correct the problem, I created a new VENV and PIP'd in 2.0.7. This version never completes the screencapture and when I ^C out of it, it's in some sort of loop wait.

DS256 avatar Aug 25 '25 14:08 DS256