Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ output/*
output
.vs/*
!assets/*.png
test_alc.ps1
testimages/*
*.ps1
Binary file added assets/excited.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/ricky.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/en-US/ConvertTo-Sixel.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,6 @@ a sixel string
## NOTES

This will only work if your terminal supports sixel images.
Windows Terminal Preview version 1.22.2702.0 or newer
Windows Terminal version 1.22 or newer

## RELATED LINKS
167 changes: 167 additions & 0 deletions docs/en-US/ConvertTo-SixelGif.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
---
external help file: Sixel.dll-Help.xml
Module Name: Sixel
online version: https://github.com/trackd/Sixel/blob/main/docs/en-US/ConvertTo-SixelGif.md
schema: 2.0.0
---

# ConvertTo-SixelGif

## SYNOPSIS

Converts a gif to a sixel animation

## SYNTAX

### ByPath (Default)

```powershell
ConvertTo-SixelGif [-Path] <string> [-MaxColors <int>] [-Width <int>] [-Force] [-LoopCount <int>] [<CommonParameters>]
```

### ByUrl

```powershell
ConvertTo-SixelGif -Url <string> [-MaxColors <int>] [-Width <int>] [-Force] [-LoopCount <int>] [<CommonParameters>]
```

## DESCRIPTION

The `ConvertTo-SixelGif` takes a gif and converts it to sixel animation

## EXAMPLES

### -------------------------- EXAMPLE 1 --------------------------

```powershell
PS C:\> ConvertTo-SixelGif -Url 'https://i.gifer.com/10j2.gif'
```

### -------------------------- EXAMPLE 2 --------------------------

```powershell
PS C:\> ConvertTo-SixelGif -Path $env:USERPROFILE\desktop\hello.gif
```

Converts a local file to sixel format

## PARAMETERS

### -Path

A path to a local gif to convert to sixel.

```yaml
Type: String
Parameter Sets: Path
Aliases: FullName

Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -Url

A URL of the gif to download and convert to sixel.

```yaml
Type: String
Parameter Sets: Url
Aliases: Uri

Required: True
Position: Named
Default value: None
Accept pipeline input: True
Accept wildcard characters: False
```

### -MaxColors

The maximum number of colors to use in the image.
Max is 256.

```yaml
Type: int
Parameter Sets: (All)
Aliases: None

Required: False
Position: Named
Default value: 256
Accept pipeline input: False
Accept wildcard characters: False
```

### -Width

Width of the image in character cells, the height will be scaled to maintain aspect ratio.

```yaml
Type: int
Parameter Sets: (All)
Aliases: CellWidth

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Force

Force the command to attempt to output sixel data even if the terminal does not support sixel.

```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Protocol

Select the image protocol to output.
Supports Sixel, InlineImageProtocol, KittyGraphicsProtocol

It will attempt to autoselect the supported image protocol for your terminal.

```yaml
Type: ImageProtocol
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

## INPUTS

### System.String

Path or url to an gif file

## OUTPUTS

### System.String

a sixel animation

## NOTES

This will only work if your terminal supports sixel images.
Windows Terminal version 1.22 or newer

## RELATED LINKS
6 changes: 5 additions & 1 deletion docs/en-US/Sixel.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ Locale: en-US

Convert images to Sixel

## Yayaml Cmdlets
## Sixel Cmdlets

### [ConvertTo-Sixel](ConvertTo-Sixel.md)

Converts an image to sixel

### [ConvertTo-SixelGif](ConvertTo-SixelGif.md)

Converts a gif to a sixel animation
29 changes: 29 additions & 0 deletions module/Sixel.format.ps1xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<Configuration>
<ViewDefinitions>
<View>
<Name>Sixel.Terminal.Models.SixelGif</Name>
<ViewSelectedBy>
<TypeName>Sixel.Terminal.Models.SixelGif</TypeName>
</ViewSelectedBy>
<CustomControl>
<CustomEntries>
<CustomEntry>
<CustomItem>
<ExpressionBinding>
<ScriptBlock>
# this is a hack to not have to expose the orchestrating cmdlet and just have it play automatically.
# probably not worth it, but it's a fun experiment.
$cmdlet = [System.Management.Automation.CmdletInfo]::new(
'Show-SixelGif',
[Sixel.Cmdlet.ShowSixelGifCmdlet]
)
$_ | &amp; $cmdlet
</ScriptBlock>
</ExpressionBinding>
</CustomItem>
</CustomEntry>
</CustomEntries>
</CustomControl>
</View>
</ViewDefinitions>
</Configuration>
34 changes: 24 additions & 10 deletions module/Sixel.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,44 @@

@{
RootModule = 'Sixel.psm1'
ModuleVersion = '0.2.5'
ModuleVersion = '0.3.0'
CompatiblePSEditions = 'Core'
PowerShellVersion = '7.4'
GUID = '95f4627c-f8f5-43d5-824b-4c356737f87b'
Author = 'trackd, ShaunLawrie'
Copyright = '(c) trackd. All rights reserved.'
Description = 'Convert images to Sixel format and display them in the terminal, Requires a terminal with Sixel support. (Windows Terminal v1.22.2912.0 or later), Inline Image Protocol or Kitty Graphics support.'
CmdletsToExport = @('ConvertTo-Sixel')
AliasesToExport = @('cts', 'ConvertTo-InlineImage')
Description = '@
Display images in the terminal using various protocols

✔️ Sixel
- requires Windows Terminal v1.22+
- Gif support using ConvertTo-SixelGif
✔️ Inline Image Protocol
- Supported by VSCode, xterm2, WezTerm, and others.
✔️ Kitty Graphics Protocol
- Supported by Kitty terminal.
✔️ Block cells
- Fallback to block cells if no image protocol is supported.
@'
CmdletsToExport = 'ConvertTo-Sixel', 'ConvertTo-SixelGif'
AliasesToExport = 'cts','gif'
FormatsToProcess = 'Sixel.format.ps1xml'
PrivateData = @{
PSData = @{
Tags = @(
'Sixel',
'Terminal',
'Graphics',
'Image',
'Console Image',
'Inline Image Protocol',
'Kitty Graphics Protocol'
'ConsoleImage',
'InlineImageProtocol',
'KittyGraphicsProtocol',
'Linux',
'Mac',
'Windows'
)
LicenseUri = 'https://github.com/trackd/Sixel/blob/main/LICENSE'
ProjectUri = 'https://github.com/trackd/Sixel'
ReleaseNotes = @'
0.3.0 - Added GIF support, added Ascii art using halfblock cells.
0.2.5 - bugfix, cleanup, added experimental support for inline image protocol and Kitty Graphics Protocol.
0.2.0 - Added better scaling, changes -Width to use cell width instead.
0.1.0 - Initial release.
Expand All @@ -36,6 +51,5 @@
# A missing or $null entry is equivalent to specifying the wildcard *. declare unused with @() for better perf.
FunctionsToExport = @()
VariablesToExport = @()
FormatsToProcess = @()
TypesToProcess = @()
}
Loading