Skip to content
trackdPublic

About

Powershell Module to Convert images to Sixel/InlineImage/Kitty

Topics

Resources

Stars

61 stars

Watchers

5 watching

Forks

Repository files navigation

Sixel

A module that lets you convert images to Sixel, Inline Images Protocol, Kitty Graphics Protocol.

PowerShell 7 uses ImageSharp for bmp, gif, jpeg, pbm, png, tiff, tga, and webp input. Windows PowerShell 5.1 uses the built-in System.Drawing/GDI+ codecs for bmp, gif, jpeg, png, and tiff. Its runtime dependencies are provided by .NET Framework and Windows PowerShell; no additional dependency DLLs are bundled for Windows PowerShell.

Install

Install-Module Sixel
# or
Install-PSResource Sixel

Requirements

This module supports Powershell version 5.1 & 7.4.

Both engines support static Sixel, Kitty, and inline images. Windows PowerShell also supports GIF frames through ConvertTo-SixelGif and ConvertTo-Kitty -Animate. Animated inline images and APNG/WebP decoding require PowerShell 7. Resampling and palette quantization differ between the two image backends, so encoded bytes and some edge pixels can differ. On .NET Framework, image-taking helper overloads use System.Drawing types instead of ImageSharp types; cmdlet parameters are unchanged.

Windows Terminal supports Sixel from version 1.22.

VSCode 1.101+, also requires "Enable Images","Windows Enable Conpty", "Windows Use Conpty Dll" enabled.

There is an example sixel file in the ./assets folder that can be used for testing

# test sixel
Invoke-RestMethod https://raw.githubusercontent.com/trackd/Sixel/refs/heads/main/assets/chibi.six

Kitty preview

ConvertTo-Kitty provides a separate preview of the full Kitty wire protocol, including native GIF animation (plus APNG/WebP on PowerShell 7), placements, deletion, composition, and Unicode placeholders. Explicit client APIs provide reply parsing, disposable local transfers, and cleanup of session-owned images. The existing ConvertTo-Sixel Kitty path remains available for comparison.

ConvertTo-Kitty ./assets/cog.png -Width 20 -ImageId 42

See Get-Help ConvertTo-Kitty -Full for parameters and examples.

Good Image Protocol preview

ConvertTo-Sixel -Protocol GoodImageProtocol emits the Good Image Protocol (DCS ! g): a cell-bound PNG with fit, alignment and layer policies. The specification is alpha and may change, so it is never chosen automatically; it is used only when asked for, after the terminal lists code 90 in its DA1 reply (or with -Force). In Contour it must be enabled with images: good_image_protocol: true. ConvertTo-GoodImage exposes the rest of the protocol: named upload, render and release, crop, alignment, resize policy, layer, raw RGB/RGBA, PNG passthrough and the limits query. [Sixel.Protocols.GoodImageSession] does the same for applications that read status replies.

[Sixel.Terminal.Compatibility]::RefreshTerminalInfo() | Out-Null
[Sixel.Terminal.Compatibility]::TerminalSupportsGoodImageProtocol()
ConvertTo-Sixel ./assets/cog.png -Width 20 -Protocol GoodImageProtocol
ConvertTo-GoodImage ./assets/cog.png -Name cog -Width 8 -Height 4 -Alignment MiddleCenter -Layer Below

See Get-Help ConvertTo-GoodImage -Full for parameters and examples.

Authors

@trackd
@ShaunLawrie

Libraries

ALC

PowerShell-ALC

examples

Example
Example

About

Powershell Module to Convert images to Sixel/InlineImage/Kitty

Topics

Resources

Stars

61 stars

Watchers

5 watching

Forks

Releases

Packages

Used by

Contributors

Languages