Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 Kumar Jul 27 '12 at 8:14
Any reason you need a subprocess for this? Look e.g. at this:… or:… – Takkat Jul 27 '12 at 14:34

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.