Switch to python script

This commit is contained in:
2025-02-05 14:46:11 +00:00
parent 604a31ed6e
commit e8bca280be
16 changed files with 235 additions and 356 deletions

26
render.py Normal file
View File

@@ -0,0 +1,26 @@
import imgkit
from PIL import Image
config = imgkit.config(wkhtmltoimage='C:\\Program Files\\wkhtmltopdf\\bin\\wkhtmltoimage.exe')
print("Generating html...")
print("Converting to image...")
imgkit.from_file('./test.html', 'out.png', config=config, options={
'format': 'png',
'crop-h': '300',
'crop-w': '400'
})
img = Image.open('./out.png')
pal_img = Image.new('P', (1,1))
pal_img.putpalette((255,255,255,0,0,0,255,0,0) + (0,0,0) * 252)
img = img.convert("RGB").quantize(palette=pal_img)
print("Updating display...")
print("Done!")