Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Using a Python script, I want to be able to open an image and close it on ubuntu.

Looking at the answer here:


Specifically this line: viewer = subprocess.Popen(['some_viewer', infile])

What should I put as the 'some_viewer'?

share|improve this question
Once you have imagemagick installed you will get a command line option called display along with it.So you can easily use viewer = subprocess.Popen(['display',infile]) . –  Vinit Jul 27 '12 at 8:14
Any reason you need a subprocess for this? Look e.g. at this: stackoverflow.com/questions/10270080/… or: stackoverflow.com/questions/11549480/… –  Takkat Jul 27 '12 at 14:34

1 Answer 1

You can use "gvfs-open" to launch the default application for the filetype.

e.g. gvfs-open test.png would open test.png in GPicView on my system, and GIMP on a system where the user has set the default application for opening png files to GIMP.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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