Skip to content

Commit

Permalink
fix: bad image generation with chromium
Browse files Browse the repository at this point in the history
  • Loading branch information
ugomeda committed Jan 27, 2025
1 parent de658fe commit e72f375
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 4 additions & 1 deletion inkplate_dashboard/chrome.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ def screenshot_display() -> tuple[bytes, str]:
"--force-device-scale-factor=1",
"--disable-lcd-text", # B&W display
f"--screenshot={screenshot_path}",
"--window-size=825,1200",
# chromium seems to eat the bottom of the page,
# we add some padding which is cut later
"--window-size=825,1500",
"--virtual-time-budget=10000",
"--timeout=5000",
"http://127.0.0.1:8000/live/html",
Expand All @@ -63,6 +65,7 @@ def screenshot_display() -> tuple[bytes, str]:
palette_img = Image.new("P", (1, 1))
palette_img.putpalette(palette * 32)
img = Image.open(screenshot_path).convert("RGB")
img = img.crop((0, 0, 825, 1200))
img = img.quantize(kmeans=0, palette=palette_img).convert("L")
img = img.rotate(90, expand=1)

Expand Down
7 changes: 3 additions & 4 deletions inkplate_dashboard/styles/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,18 @@ $spacing: 30px;


// Layout
body {
html, body {
margin: 0;
background: #aaa;
}

#display {
background: #fff;
width: 825px;
height: 1200px;
box-sizing: border-box;
overflow: hidden;
font-weight: 300;
font-size: $font-size-default;
border-bottom: 1px solid #000;
border-right: 1px solid #000;
font-family: $font-family-default;
}

Expand Down

0 comments on commit e72f375

Please sign in to comment.