How can I display an image in the terminal? - image

Is there any sort of utility I can use to convert an image to ASCII and then print it in my terminal? I looked for one but couldn't seem to find any.

A program called cacaview allows you to do this.
It is interactive, allowing you to pan, zoom, and change display modes.
(Full size image)

more simply, you may use img2txt from the caca library (cacaview is an image browser and opens a new window, which is not what is asked here I guess);
For instance :
on macosx, you may use homebrew :
$ brew reinstall libcaca --with-imlib2
(imlib is used to convert from different formats)

Try using the Google-Ninja before asking!
I found cacaview and aview.

A high quality fast standalone conversion utility (provided you have a 256 color terminal) is pxl, available at https://github.com/ichinaski/pxl.

Here's a utility that does this (with source code):
http://www.codeproject.com/Articles/10949/ASCII-Art-Generator

Chafa
I like to use chafa.
chafa example.png
You can download Chafa from Chafa's website or from your favourite package manager, like APT:
sudo apt install chafa

Another alternative is to use the Ipython notebook: it is pretty good at doing what you ask for.
For bash: You have to prepend commands with a bang.
For images: You may use the rich display system from ipython.
A screenshot of the result:
Complete answer in this post.

Related

Cygwin command forwarding?

I'm trying to configure my Cygwin64 terminal to do certain existing commands using shorter keywords. For example, I want to be able to use clear by typing clr in all cases. However, I still want the original clear to work. Is this type of command "forwarding" possible?
This is known as command aliasing:
alias clr=clear
Both clr and clear will work
I hope this helps!

OCaml color console output

Is it possible to colour the console output with OCaml on Windows ?
It seems to be possible on a linux terminal : print_string "\027[31m blabla" but I cannot find any information regarding the Windows console.
Using ther Vanilla windows tooling..
Color management is not possible by default using the command ( ms dos ) console emulation.
Out of the box, the best you can get is by using the PowerShell command line interface instead and to configure the colors like explained in this page.
In an opened terminal:
write-host -foregroundcolor Red "Hello"
will result in Hello printed in Red ...
But this is not convenient at all..
A better solution provided by an external tool
The easiest way is to uses an external tool to do the job, but you'll need to install a kind of windows command line extension.
A nice project can be found HERE it's called ANSICON and will directly interpret the ANSI codes the same way the Linux modern terminal emulators does.
You may be interested in ANSITerminal
. I do not remember how good the Windows version is — I personally do not use that platform — but do not hesitate to fill issues or submit pull requests.
If you are looking for ANSI color support (and more) in cmd.exe you can use clink.

Guake terminal with 256 colors?

Is it possible to make Guake terminal to use 256 colors instead of just 8?
The only info that I found on the internet is this post https://bbs.archlinux.org/viewtopic.php?id=173707 but it didn't work.
Guake supports natively 256 colours. And this is the answer to your question ;)
For testing it, you can simply run this script.
Ok fixed: You just need to run this scripts provided here:
https://github.com/coolwanglu/guake-colors-solarized

Copy into the system clipboard from local vim on mac

It seems like versions of this question have been asked here before, but I haven't been able to glean from them the exact response to what I am looking for.
Say I open up a .txt file via vim on my mac machine and I then want to copy a line from that file to be used in another .txt file or in a google search or in terminal during an ssh session. What would be the simplest way to do this?
Thanks,
EDIT
Found a potential duplicate: Vim: copy selection to OS X clipboard. But I am open to improvements! :)
i'm not sure wether it works for osx too but here on linux i use "+<yank>, there is also "*<yank>
see also http://vim.wikia.com/wiki/Copy_an_Entire_Buffer_to_the_Clipboard
As mentioned in the other answer, use the + register or * register.
In some environments, * and + may not behave as expected. To enable the expected behavior, use a plugin like fakeclip. Fakeclip enables clipboard support when it is not available out of the box.

Third-party windows command-line program?

Looking for a better Windows XP command-line interface. The Visual Studio Command Prompt isn't near as nice as the Linux/OSX terminals.
Thoughts?
edit:
Answers: Console on Sourceforge, and the Windows Powershell. Thanks, I'll go dig them up and evaluate them.
The Cygwin package is too much overhead for what I want.
edit2:
Looks like the Windows Powershell for now. Its copy&paste functionality isn't great, but MS supports it.
Take a look at Console2 http://sourceforge.net/projects/console/
It's features:
"multiple tabs, text editor-like text selection, different background types, alpha and color-key transparency, configurable font, different window styles"
As has your question been tagged, have you tried Windows PowerShell? It's paradigm is based on unix's pipes but instead of outputting text the processes output .Net objects.
cygwin? www.cygwin.com. Or mingwin?
Cygwin
This is an answer extending line.
I'm not clear on what you mean by Linux/OSX command prompts being "nice". If you just mean that they provide more utilities, I usually install Windows Services for Unix to add common programs like grep and vi.
I see you put "powershell" as one of your tags. Maybe you could help direct our answers by explaining what you don't like about PowerShell as a replacement for cmd.exe?
I use Take Command from JP Software
Cygwin is a good alternative. You can run Bash or other shells on Windows. You get most of your classic Linux/UNIX commands, shell scripting, etc. You even get the GNU compilers and can avoid Visual Studio if you wish. From Cygwin, you can access your regular Windows programs, drives, etc so there's rarely a reason to go back to cmd.exe.
If you are just looking to automate tasks via shell scripts (not interactive shell), then you should look at Windows Scripting Host. WSH is a feature-rich scripting environment for Windows that comes pre-installed on all modern versions of Windows.
I've been combining putty, cygwin, screen, and zsh(not bash) lately. I like a lot of the features of zsh, like autocd which and auto-pushd, which put the directories you change into onto the directory stack without having to type pushd. I also like that fact that multiple shells share history, and don't overwrite each other. Screen lets me run multiple zsh shells in one putty window. You can get zsh and screen from the cygwin site. I run: putty -cygterm screen
You'll also need the patched version of putty that has the -cygterm support.
GitBash by git is also a good option. It can be configured to be used in unix like environment.
It can be downloaded from here http://msysgit.github.io/

Resources