I have an image hosted at a specific url online and I would like that image to appear in the terminal when run. Is that possible or is there a way the image can be shown in a native image viewer?
Asked
Active
Viewed 121 times
0
-
Other than using an image viewer that accepts URLs? – Ignacio Vazquez-Abrams Dec 18 '17 at 05:02
-
Are you sure you want the image to appear in the terminal, if so, [this question](https://stackoverflow.com/questions/12233105/how-can-i-display-an-image-in-the-terminal) provides some options could be launched from python. What operating system are you running on? – import random Dec 18 '17 at 05:29
1 Answers
0
You'll need some way of fetching and displaying the image. A web browser can do both of those things, so one way to do what you want is to start up a web browser and point it at the desired URL:
import webbrowser
webbrowser.open(url)
If the user already has a web browser open but it is not currently visible (i.e. it's minimized or it's on a different virtual desktop), it might work better to tell webbrowser
to open the page in a new window, which would (presumably) be displayed on the current screen:
webbrowser.open_new(url)
However, this is not guaranteed to work (perhaps the browser is configured to always display new urls in a tab instead of a new window, etc etc.)

John Gordon
- 29,573
- 7
- 33
- 58