From f00aad49168599c8e504ff9d037340573e827afe Mon Sep 17 00:00:00 2001 From: Tobias Falk Date: Sat, 8 Jun 2024 18:23:29 +0200 Subject: [PATCH 1/2] Added option to set the dpi of the output this adds the option 'output_dpi' for the user. This is used to set the 'dpi' of the output, the default is 96 wich is also the default GraphViz default. https://graphviz.org/docs/attrs/dpi/ --- src/wireviz/DataClasses.py | 1 + src/wireviz/Harness.py | 1 + 2 files changed, 2 insertions(+) diff --git a/src/wireviz/DataClasses.py b/src/wireviz/DataClasses.py index 5b4bb068e..c3acc1459 100644 --- a/src/wireviz/DataClasses.py +++ b/src/wireviz/DataClasses.py @@ -58,6 +58,7 @@ class Options: color_mode: ColorMode = "SHORT" mini_bom_mode: bool = True template_separator: str = "." + output_dpi: Optional[float] = 96.0 def __post_init__(self): if not self.bgcolor_node: diff --git a/src/wireviz/Harness.py b/src/wireviz/Harness.py index 30468a6a2..02dabd0ac 100644 --- a/src/wireviz/Harness.py +++ b/src/wireviz/Harness.py @@ -172,6 +172,7 @@ def create_graph(self) -> Graph: bgcolor=wv_colors.translate_color(self.options.bgcolor, "HEX"), nodesep="0.33", fontname=self.options.fontname, + dpi = f'{self.options.output_dpi}', ) dot.attr( "node", From 2c72d2edb7c3b2736a4e3ae89ef1ea101b519a65 Mon Sep 17 00:00:00 2001 From: Tobias Falk Date: Sat, 8 Jun 2024 18:27:26 +0200 Subject: [PATCH 2/2] added output_dpi documantation --- docs/syntax.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/syntax.md b/docs/syntax.md index de6728476..37e25e940 100644 --- a/docs/syntax.md +++ b/docs/syntax.md @@ -387,6 +387,9 @@ If any component is defined in the `connectors` or `cables` sections but not ref # about additional components inside the diagram node (connector/cable box). # If False, show all info about additional components inside the diagram node. mini_bom_mode: # Default = True + + # DPI setting for image outputs, https://graphviz.org/docs/attrs/dpi/ + output_dpi: # Default 96.0 ```