Opening multiple images in a directory using Image Viewer (Eye of GNOME)

R.R. :

I've 9025 files (from img_00000.png to img_009024.png) within a folder and I don't know how to write a python code that allows me to open one Image Viewer's window starting from the first file and that let me click to scroll through all the other images. How could I do this? Thank you!

import glob
flist = glob.glob('out/*.png')
flist = sorted(flist)
mrzrm :

In terminal you can run the Eye of GNOME (EoG) using the command eog. This command can accept another argument as a directory path which you want to open it in EoG. So you can open a directory using eog /path/to/directory. For more options you can run eog --help.

Finally you can run this command using os in Python.

import os
os.system("eog %s" % "/path/to/directory")

Also another alternative is using subprocess like below.

import subprocess
subprocess.run(["eog", "/path/to/directory"])

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=32909&siteId=1