Skip to content
ConsoleMonster
Cmdlet

New-ConsoleImage

Module
ConsoleMonster
Inputs
System.Management.Automation.PSObject
Outputs
ConsoleMonster.Graphics.ConsoleImage

Creates an image to place inside panels, columns and dashboards.

Syntax

New-ConsoleImage
[-Height <Int32>]
[-Label <String>]
[[-Path] <String>]
[-Width <Int32>]
[<CommonParameters>]
#
Parameter set: Path
New-ConsoleImage
-Bytes <Byte[]>
[-Height <Int32>]
[-Label <String>]
[-Width <Int32>]
[<CommonParameters>]
#
Parameter set: Bytes

Description

Inside layouts and live dashboards the image is drawn with half blocks on terminals with 256 colours or more, so it redraws cleanly with the rest of the screen; redirected and no-colour output gets [image: name WxH]. To print an image on its own with the terminal's real pixels, use Show-ConsoleImage.

Examples

Example 1

New-ConsoleColumns -Content { New-ConsolePanel -Title 'Latency' -Content { New-ConsoleImage -Path ./latency.png -Width 40 }; New-ConsolePanel -Title 'Summary' -Content { New-ConsoleKeyValue -InputObject ([ordered] @{ P50 = '41 ms'; P99 = '180 ms' }) } } | Show-Console

A chart next to its numbers

Parameters

-Height Int32 optional
Height in cells. With -Width as well, the image fits inside that box; the aspect ratio is always kept.
-Label String optional
The text in the placeholder that redirected and CI output get, [image: label WxH]. Defaults to the file name.
-Path String optionalposition: 0sets: Path
A PNG, JPEG, GIF, BMP, TIFF or PPM file. Files from Get-ChildItem and path strings can also be piped in.
-Width Int32 optional
Width in cells. Without -Width or -Height the image takes one cell per 10 pixels, up to the window width.
-Bytes Byte[] requiredsets: Bytes
Encoded image bytes, for example a chart rendered to PNG in memory.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.