Giter VIP home page Giter VIP logo

imgcat's Introduction

Imgcat

Go Report Card License MIT Go Doc Release

Display images and gifs in your terminal emulator.

Features

  • Animated GIF support
  • Accept media through stdin
  • Transparency

Installation

MacOS

brew install danielgatis/imgcat/imgcat

Linux

First, install snapcraft.

sudo snap install imgcat

Windows

First, install scoop.

scoop bucket add scoop-imgcat https://github.com/danielgatis/scoop-imgcat.git
scoop install scoop-imgcat/imgcat

Download binaries

Alternatively, you can download a pre-built binary here.

Build from source

First, install Go.

Next, fetch and build the binary.

go install github.com/danielgatis/imgcat@latest

or, if you use pre-1.17 Go version, use the go get command:

go get -u github.com/danielgatis/imgcat

Usage

Display a remote image

curl -s http://input.png | imgcat

Display a local image

imgcat path/to/image.png

Requirements

Your terminal emulator must be support true color and use a monospaced font that includes the lower half block unicode character (▄ U+2584).

License

Copyright (c) 2020-present Daniel Gatis

Licensed under MIT License

Buy me a coffee

Liked some of my work? Buy me a coffee (or more likely a beer)

Buy Me A Coffee

imgcat's People

Contributors

carbocation avatar danielgatis avatar dependabot[bot] avatar goreleaserbot avatar harvastum avatar hezhizhen avatar nishith-savla avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

imgcat's Issues

pixelated images?

Hey! Super cool tool!

I've installed this on a linux machine. The images appear pixelated while using the default terminal or even tabby

Here is an example of using imgcat:

Screenshot from 2023-08-17 10-17-55

And the image opened normally

Screenshot from 2023-08-17 10-18-35

is there any getting around the pixelation?

Windows Terminal run error with panic

I installed imgcat with scoop and run it to display avatar.png .
imgcat throw error with below:

(base) PS C:\Users\mago\Downloads> imgcat avatar.png
2024/03/19 10:55:42 failed to get the terminal size: unsupported
panic: failed to get the terminal size: unsupported

goroutine 1 [running]:
log.Panicf({0x8cd730, 0xc0000060c0}, {0xc000109f10, 0x18cd63, 0x18cd64})
        /opt/hostedtoolcache/go/1.17.7/x64/src/log/log.go:361 +0x67
main.scale({0xc000064000, 0x1, 0x18cd64})
        /home/runner/work/imgcat/imgcat/main.go:151 +0xe8
main.main()
        /home/runner/work/imgcat/imgcat/main.go:287 +0x15f

Permission denied when reading files

Using the snap package, imgcat returns permission denied error when a file is given as input in the argument.

However, it works fine when reading standard input (e.g. cat <image>.jpg | imgcat). Here is an example:

imgcat

I have tested it on Ubuntu 18.04 LTS & 20.04 LTS. Thanks for the follow-up in advance!

edit: typo

panic: runtime error: invalid memory address or nil pointer dereference

imgcat JIF.png
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x341535]

goroutine 1 [running]:
github.com/creack/pty.Getsize(...)
        /home/runner/go/pkg/mod/github.com/creack/pty@v1.1.17/winsize.go:23
main.scale({0xc000088220, 0x1, 0x111e7a})
        /home/runner/work/imgcat/imgcat/main.go:148 +0x75
main.main()
        /home/runner/work/imgcat/imgcat/main.go:277 +0x8f
NativeCommandExitException: Program "imgcat.exe" ended with non-zero exit code: 2.

I get this whenever I attempt to open any image file

Adds spurious color to grayscale images

This is a great tool. Just wanted to mention that it adds spurious color to grayscale images. Glancing at the code, this is probably related to the resampling filter during resizing.

Imgcat and Vifm

Thanks a lot for Imgcat! It's the only way I have found to preview images in a Windows command prompt.

I am trying to get Imgcat and Vifm work together on Windows 10, using Imgcat to show images in Vifm's preview pane.

Imgcat works fine by itself in cmd prompt but it does not seem to work from Vifm, producing the error message:
failed to get the console state: The handle is invalid.

Since I wasn't sure where the problem is rooted, I first asked over at Vifm. From what I understand Vifm expects some kind of output while Imgcat prints directly to the console.

A workaround was tried but didn't help. Here's the Question over at Vifm's github for reference:
vifm/vifm#671

I am not sure if it is possible on Windows at all, but could Imgcat be made to give Vifm the right output somehow?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.