Skip to content
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

feat: switch to new chromium headless mode #117

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

SebastianScheidegger
Copy link
Contributor

@SebastianScheidegger SebastianScheidegger commented Mar 12, 2025

Revert debian->alpine change
Add --headless=new

Proposed changes

Switch back to debian and use new headless mode

Checklist

Before creating a PR, run through this checklist and mark each as complete:

  • I have read the CONTRIBUTING document
  • If applicable, I have added tests that prove my fix is effective or that my feature works
  • If applicable, I have checked that any relevant tests pass after adding my changes
  • I have updated any relevant documentation

Revert debian->alpine change
Add --headless=new
@SebastianScheidegger SebastianScheidegger requested review from a team as code owners March 12, 2025 14:37
@SebastianScheidegger SebastianScheidegger linked an issue Mar 12, 2025 that may be closed by this pull request
@@ -16,7 +16,7 @@

# Process img tags, replacing base64 SVG images with PNGs
def process_svg(html: str) -> str:
pattern = re.compile(r'<img(?P<intermediate>[^>]+?src="data:)(?P<type>[^;>]+)?;base64,(?P<base64>[^"]+)?"')
pattern = re.compile(r'<img(?P<intermediate>[^>]+?src="data:)(?P<type>[^;>]+)?;base64,\s?(?P<base64>[^">]+)?"')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?

Copy link
Contributor Author

@SebastianScheidegger SebastianScheidegger Mar 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I updated this repository with the repo template, I adjusted the regex to take fewer steps
But I overlooked those two characters

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the old implementation was:
pattern = re.compile(r'<img(?P[^>]+?src="data:)(?P[^;>]?);base64,\s?(?P[^">]?)"')

@@ -156,7 +156,7 @@ def create_chromium_command(width: int, height: int, png_filepath: Path, svg_fil

command = [
chromium_executable,
"--headless=old",
"--headless=new",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changing headless mode to new introduces the issue that bottom part of SVG is cut

Fix new headless bottom cut problem
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

Successfully merging this pull request may close these issues.

Switch to new chromium headless mode
3 participants