2

I am making some code for Python on a Ubuntu OS. I have set the OS default program for opening .png images to ImageJ. However when I try to open an image in Python it opens it with the viewer that comes with the OS. Namely, the sample code I am using to show images is:

import os
from scipy import misc

path = os.path.abspath(os.path.dirname(__file__))
image = misc.imread(path + "/Lena.png")
misc.imshow (image)

I would like to know what I have to do to automatically open images in Python with the ImageJ.

Thank you all.

Jalo
  • 1,131
  • 1
  • 12
  • 28
  • "Uses the image viewer specified by the environment variable SCIPY_PIL_IMAGE_VIEWER, or if that is not defined then see, to view a temporary file generated from array data." – MrAlexBailey Jan 11 '16 at 16:31
  • @Jkdc well, I set the variable with the statement os.environ["SCIPY_PIL_IMAGE_VIEWER"]="imagej" and it works correctly. However, I would like to know how to set it as default for every session – Jalo Jan 11 '16 at 17:51
  • 1
    Then you'll need to change it in Ubuntu or add it to the top of your Python script. See [here](http://stackoverflow.com/questions/2655641/make-java-home-easily-changable-in-ubuntu) for some info on setting the environment variable permanently – MrAlexBailey Jan 11 '16 at 17:56
  • Thank you, it worked good using your advice. I have set a new enviroment variable in Ubuntu and worked correctly – Jalo Jan 12 '16 at 11:11

0 Answers0