From 04cbc8bc7c02f3b4bef8dfe64a6eaa22b565b522 Mon Sep 17 00:00:00 2001 From: Tim Carman Date: Tue, 16 Jun 2026 16:00:09 +1000 Subject: [PATCH 1/2] Add -Dpi parameter to New-AbrDiagram Expose the Graphviz dpi graph attribute so raster (PNG/JPG) output resolution can be set explicitly instead of being fixed at the Graphviz default of 96. Co-Authored-By: Claude Sonnet 4.6 --- AsBuiltReport.Diagram/AsBuiltReport.Diagram.psd1 | 2 +- .../Src/Public/New-AbrDiagram.ps1 | 16 +++++++++++++++- CHANGELOG.md | 6 ++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/AsBuiltReport.Diagram/AsBuiltReport.Diagram.psd1 b/AsBuiltReport.Diagram/AsBuiltReport.Diagram.psd1 index 52ead84..7f17b49 100644 --- a/AsBuiltReport.Diagram/AsBuiltReport.Diagram.psd1 +++ b/AsBuiltReport.Diagram/AsBuiltReport.Diagram.psd1 @@ -12,7 +12,7 @@ RootModule = 'AsBuiltReport.Diagram.psm1' # Version number of this module. - ModuleVersion = '1.0.7' + ModuleVersion = '1.0.8' # Supported PSEditions # CompatiblePSEditions = @() diff --git a/AsBuiltReport.Diagram/Src/Public/New-AbrDiagram.ps1 b/AsBuiltReport.Diagram/Src/Public/New-AbrDiagram.ps1 index 7d3cd9e..e1efb71 100644 --- a/AsBuiltReport.Diagram/Src/Public/New-AbrDiagram.ps1 +++ b/AsBuiltReport.Diagram/Src/Public/New-AbrDiagram.ps1 @@ -123,6 +123,9 @@ function New-AbrDiagram { .PARAMETER MainGraphAttributes Hashtable of graph attributes to override or augment defaults (examples: fontname, fontcolor, imagepath, style, nodesep, ranksep, bgcolor). + .PARAMETER Dpi + Raster output resolution in dots per inch for PNG/JPG formats (Ex: 300). Default: 96 (Graphviz default). + .PARAMETER WaterMarkColor Color used for watermark text. Default: 'DarkGray'. @@ -488,7 +491,14 @@ function New-AbrDiagram { HelpMessage = 'Set the image size in percent (100% is default)' )] [ValidateRange(1, 100)] - [int] $MainGraphLogoSizePercent = 100 + [int] $MainGraphLogoSizePercent = 100, + + [Parameter( + Mandatory = $false, + HelpMessage = 'Allow to set the raster output resolution in dots per inch (Ex: 300). Default: 96 (Graphviz default)' + )] + [ValidateRange(72, 600)] + [int] $Dpi ) begin { @@ -567,6 +577,10 @@ function New-AbrDiagram { if ($MainGraphSize) { $MainGraphAttributes['size'] = $MainGraphSize } + + if ($Dpi) { + $MainGraphAttributes['dpi'] = $Dpi + } } process { diff --git a/CHANGELOG.md b/CHANGELOG.md index c7917d3..7df23f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.0.8] - 2026-06-16 + +### :rocket: Added + +- Add `-Dpi` parameter to `New-AbrDiagram`, allowing the raster output resolution (PNG/JPG) to be set directly via the Graphviz `dpi` graph attribute instead of being fixed at the Graphviz default of 96 + ## [1.0.7] - 2026-05-02 ### :arrows_clockwise: Changed From 268710d21bd9bca3296269d1eceabe0531e310e8 Mon Sep 17 00:00:00 2001 From: Tim Carman <15333667+tpcarman@users.noreply.github.com> Date: Tue, 16 Jun 2026 18:05:45 +1000 Subject: [PATCH 2/2] Add IconWidth/IconHeight parameters to Add-HtmlNodeTable The icon for a regular (non-subgraph) node had no width/height/fixedsize attribute, so its rendered size was derived purely from the source image's pixel count interpreted as Graphviz points. This made resizing the source PNG an unreliable way to control on-page icon size. Mirrors the existing SubgraphIconWidth/SubgraphIconHeight pattern. --- .../Src/Private/Add-HtmlNodeTable.ps1 | 25 ++++++++++++++++--- CHANGELOG.md | 1 + 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/AsBuiltReport.Diagram/Src/Private/Add-HtmlNodeTable.ps1 b/AsBuiltReport.Diagram/Src/Private/Add-HtmlNodeTable.ps1 index 5215f85..11d66f7 100644 --- a/AsBuiltReport.Diagram/Src/Private/Add-HtmlNodeTable.ps1 +++ b/AsBuiltReport.Diagram/Src/Private/Add-HtmlNodeTable.ps1 @@ -120,6 +120,12 @@ function Add-HtmlNodeTable { .PARAMETER SubgraphIconHeight Allow to set a subgraph icon height. + .PARAMETER IconWidth + Allow to set the icon width. When combined with IconHeight, the icon's table cell is fixed to that size and the image is scaled to fit. + + .PARAMETER IconHeight + Allow to set the icon height. When combined with IconWidth, the icon's table cell is fixed to that size and the image is scaled to fit. + .PARAMETER TableBackgroundColor Allow to set a table background color (Hex format EX: #FFFFFF). @@ -400,6 +406,18 @@ function Add-HtmlNodeTable { )] [string] $SubgraphIconHeight, + [Parameter( + Mandatory = $false, + HelpMessage = 'Allow to set the icon width' + )] + [string] $IconWidth, + + [Parameter( + Mandatory = $false, + HelpMessage = 'Allow to set the icon height' + )] + [string] $IconHeight, + [Parameter( Mandatory = $false, HelpMessage = 'Allow to set a table background color' @@ -634,16 +652,17 @@ function Add-HtmlNodeTable { } } } else { + $IconSizeAttr = if ($IconWidth -and $IconHeight) { ' fixedsize="true" width="{0}" height="{1}"' -f $IconWidth, $IconHeight } else { '' } if ($MultiIcon) { while ($Number -ne $Group.Count) { if ($Icon.Count -gt 1) { foreach ($Element in $Group[$Number]) { - $TDICON += '' -f $Align, $Icon[$iconNumber] + $TDICON += '' -f $Align, $IconSizeAttr, $Icon[$iconNumber] $iconNumber++ } } else { foreach ($Element in $Group[$Number]) { - $TDICON += '' -f $Align, $Icon + $TDICON += '' -f $Align, $IconSizeAttr, $Icon } } $TR += '{0}' -f $TDICON @@ -708,7 +727,7 @@ function Add-HtmlNodeTable { } else { $TDICONMatch = if ($Icon.Count -eq 1) { $Icon } else { $Icon[0] } - $TDICON += '' -f $Align, $inputObject.Count, $TDICONMatch + $TDICON += '' -f $Align, $inputObject.Count, $IconSizeAttr, $TDICONMatch $TR += '{0}' -f $TDICON diff --git a/CHANGELOG.md b/CHANGELOG.md index 7df23f4..85ac778 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### :rocket: Added - Add `-Dpi` parameter to `New-AbrDiagram`, allowing the raster output resolution (PNG/JPG) to be set directly via the Graphviz `dpi` graph attribute instead of being fixed at the Graphviz default of 96 +- Add `-IconWidth`/`-IconHeight` parameters to `Add-HtmlNodeTable`, allowing the rendered icon size in a node's HTML table to be set explicitly instead of being derived solely from the source image's pixel dimensions ## [1.0.7] - 2026-05-02