Show-ConsoleImage
Shows an image in the console, at the size you ask for in cells.
Syntax
Show-ConsoleImage
[-Height <Int32>]
[-Label <String>]
[[-Path] <String>]
[-Protocol <HalfBlock| Sixel| ITerm2| Kitty>]
[-Width <Int32>]
[<CommonParameters>]#PathShow-ConsoleImage
-Bytes <Byte[]>
[-Height <Int32>]
[-Label <String>]
[-Protocol <HalfBlock| Sixel| ITerm2| Kitty>]
[-Width <Int32>]
[<CommonParameters>]#BytesDescription
Draws real pixels in terminals with an image protocol: Kitty and Ghostty (Kitty graphics), iTerm2 and WezTerm (iTerm2 inline images) and Windows Terminal (Sixel). Other terminals with 256 colours or more get half blocks. Redirected, CI, remote, 16-colour and no-colour output, the ISE and sessions with a transcript running get one line, [image: name WxH]. Get-ConsoleCapability shows the protocol in ImageProtocol. The aspect ratio is always kept. To put an image inside a panel or dashboard, use New-ConsoleImage.
Examples
Example 1
Show-ConsoleImage -Path ./chart.png -Width 40Show a chart 40 cells wide
Example 2
Get-ChildItem ./screens -Filter *.png | Show-ConsoleImage -Height 12Preview every screenshot in a folder
Example 3
Show-ConsoleImage -Path ./logo.png -Width 24 -Protocol HalfBlockUse half blocks, for example over a connection that drops image sequences
Example 4
Show-ConsoleImage -Path ./diagram.png -Protocol KittyUse Kitty graphics in a terminal that supports it but isn't detected
Parameters
- -Height Int32
- Height in cells. With -Width as well, the image fits inside that box; the aspect ratio is always kept.
- -Label String
- The text in the placeholder that redirected and CI output get, [image: label WxH]. Defaults to the file name.
- -Path String
- A PNG, JPEG, GIF, BMP, TIFF or PPM file. Files from Get-ChildItem and path strings can also be piped in.
- -Protocol ImageProtocol
- The protocol your terminal supports, when detection chose another one: Kitty, ITerm2, Sixel, HalfBlock or None (the placeholder). Redirected and CI output keep the placeholder.
- Possible values:
HalfBlock,Sixel,ITerm2,Kitty - -Width Int32
- Width in cells. Without -Width or -Height the image takes one cell per 10 pixels, up to the window width.
- -Bytes Byte[]
- 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.