I'm using the telegram-cli commandline client on Ubuntu, my Ubuntu phone and on my FreeBSD desktops. Works very fine. I do not unterstand how to download and view images others sent me. The help does not say much about. It points to the syntax with some 'msg-id', what could be this?

For example, if someone sends me a image it says:

[22:14]  Lina  »»» [image 32.webp: type=image/webp size=336x512 size=28KiB] 

How can I access this image?


You can see this line in help of telegram-cli.

view_photo <msg-id>     Downloads file to downloads dirs. Then tries to open it with system default action

That says, you should enter msg-id as an argument to view_photo.

For knowing msg-id of a message, you should use -N or --enable-msg-id arguments.

For example you should run telegram-cli with this command:

telegram-cli --enable-msg-id

And you can see a number before your message. That number is your message id. For example:

12 [22:14]  Lina  »»» [image 32.webp: type=image/webp size=336x512 size=28KiB] 

Here your msg-id is 12, So for show that image you can use this command:

view_photo 12

But this is not really a photo, its Stickers of Telegram (Because of its .webp format).

For see this type of image you can use imagemagick with webp package.

sudo apt install imagemagick webp

So you can use view_photo <msg-id> command in telegram-cli, and then choose imagemagick from applications list. That image should be shown.


The information of ali76 contains the missing link, the piece of information I missed. I saw already in the help, that I have to use a msg_id and how to enable this, but did not know which number of the chat line it was, i.e. this is missing in the help. Having this clear now, I debugged it in my desktop:

  1. telegram-cli downloads the file to ~/.telegram-cli/downloads
  2. starts /usr/local/bin/xdg-open filename (a simple shell script)
  3. this in turn starts /usr/local/bin/kde-open filename

The latter knows how to open certain image types, for *.webp I used /usr/local/bin/display (from the ImageMagick suite) and let kde-open remember this selection for this type of file.

  • Hi guru; I says that the number before that line is the msg-id for example in 1234 [22:14] Lina »»» [image 32.webp: type=image/webp size=336x512 size=28KiB] , 1234 is your msg-id . And you can see this image with view_photo and no need to goes to ~/.telegram-cli/downloads directory. Aug 31 '17 at 11:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.