Home > database >  How to display an image in the terminal with Java
How to display an image in the terminal with Java

Time:11-18

I'm creating a command line app in Java and wanted to know if it was possible to output an image in the terminal. Looked up online but could not find anything...

Thanks!

CodePudding user response:

You can't output an image in the terminal with Java.

The closest you can get is to output ASCII art, in which case, you could use something like TEXT-IMAGE.com to generate a set of characters that can be outputted to the terminal to resemble a image.

CodePudding user response:

You can display an image in the Terminal if your terminal accepts the "Inline Images Protocol" a.k.a. OSC codes. It is basically a few bytes of header, a base64-encoded PNG image and a couple of bytes to mark the end of the sequence.

Example here.

There is a similar tool called showimg and its source is here.

  • Related