Feature request: double-clicking an imgcat'ed image would open the image

39 views
Skip to first unread message

Alexandre Champagne

unread,
Aug 3, 2021, 11:44:33 PM8/3/21
to iterm2-discuss
I find myself using the much useful imgcat a lot with iTerm2 while analyzing data with Python. However the image is quite small in the terminal and I often right click --> open image to zoom in. I know I can make the text bigger in iTerm2, but I’m talking about plotted data so sometimes I have to zoom quite a lot.

Now having to do that 3 times a day is one thing, but I’m doing this repeatedly maybe 100 times a day. Double clicking would be nice there !

For the record, I’m using that over SSH so I can’t just open the image (locally) using my own code.

Richard Mitchell

unread,
Aug 4, 2021, 9:44:28 AM8/4/21
to iterm2-discuss
I'm not disagreeing with your suggestion.  imgcat isn't a magical program.  There is an escape sequence that precedes image data and then a few bytes at the end.  I've written my own version in C that also scales, positions, and will display multiple images side in rows/columns and  a bunch of other silly stuff.  I've also written a plotting program than generates a ppm file that gets written to stdout in-between the two escape sequences.

If you're writing code on Python, I don't see why you can't do the same with your own scaling.  Of course, if the image size exceeds the terminal window size, nothing beats a separate viewer with zoom and pan.

Alexandre Champagne

unread,
Aug 4, 2021, 12:22:18 PM8/4/21
to iterm2-discuss
Well I often have multiple split windows with multiple SSH sessions going on, so showing a bigger image with imgcat isn’t really an optimal solution here. Switching tab/etc. would take longer than the "right-click+open image" solution. I could always use an image viewer over SSH but I it wouldn’t work as well as just opening the image file locally (plus, I don’t have root access to the SSH server so I can’t install e.g. feh).

Alexandre Champagne

unread,
Aug 4, 2021, 1:19:08 PM8/4/21
to iterm2-discuss
Came up with a temporary fix: using BetterTouchTools, Force Click trigger --> right click + 'o' + [enter]. Thus, I can force click images and they open in the external viewer.
Reply all
Reply to author
Forward
0 new messages