Specify a base URL for relative URLs in the input HTML file

weasyprint

weasyprint {{path/to/input.html}} {{path/to/output}}.png --base-url {{url_or_filename}}

click the source code to copy install weasyprint on any operating system with command-not-found.com