Skip to content

Show Input Image (sii), show / see / view image in commandline in 256 colors

Notifications You must be signed in to change notification settings

333van/ShowInputImage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sample Output

Note:

Build

gcc main.c -o sii

Example

# PowerShell
sii `
input.jpg <# Input Image path #> `
50        <# Output width #>
<#
Use PowerShell and nircmd to create 'siiX', resulting in a high resolution output.
Adjusting OUT_WIDTH_MAX in ./main.c per your display device is recommended.
- nircmd: https://nircmd.nirsoft.net/sendkeypress.html
- PowerShell (pwsh): https://github.com/PowerShell/PowerShell
This could be implemented in C with the 'SendInput' function, but I don't plan to do so.
- SendInput(): https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-sendinput
#>
function siiX($imagePath, $zoomLevel=10, $sleepTime=0.5, $zoomInterval=0.05) {
  function Zoom($mode='in'){
    $zoomTime = 0
    while($zoomTime -lt $zoomLevel){
      switch($mode){
        'in'  { nircmd sendkeypress ctrl+minus }
        'out' { nircmd sendkeypress ctrl+plus }
      }
      $zoomTime = $zoomTime + 1
      Start-Sleep $zoomInterval
    }
  }
  Zoom -Mode 'in'
  Start-Sleep $sleepTime # for detecting the terminal width and height accurately
  sii $imagePath
  $UserInput = Read-Host # pause before restoring the zoom level, just press Enter
  Zoom -Mode 'out'
}

siiX test.jpg # <-- Try it out

License

MIT

Credits

About

Show Input Image (sii), show / see / view image in commandline in 256 colors

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published