I am using a python notebook. In it, I have code that creates images, and am using image.show()
for debugging purposes. However, this has the disadvantage that I cannot name the image, since it has a temporary file name. I am then using image.save("name.png") to save the images with different names, and then using Image.open("name.png") to open it. However, when I do this, only the last image is actually opened. What do I need to do so that I can call Image.open on several images and they all open? For example if I do:
image = Image.fromarray( ... )
image.save("original.png")
Image.open("original.png")
image = Image.fromarray( ... )
image.save("reconstruction.png")
Image.open("reconstruction.png")
only "reconstruction.png" shows.
If I use Image.show() after each of them
image = Image.fromarray( ... )
image.show()
image = Image.fromarray( ... )
image.show()
it will work, but they will have a temporary name, which is meaningless, and if I end up with 7-8 open images I want an easy way to track what is what.
Image.show() is mainly for debugging use:
Displays this image. This method is mainly intended for debugging purposes.
On Unix platforms, this method saves the image to a temporary PPM file, and calls the xv utility.
On Windows, it saves the image to a temporary BMP file, and uses the standard BMP display utility to show it (usually Paint).
You can give a title parameter, but it doesn't show on Windows:
title – Optional title to use for the image window, where possible.
You can use different names for image variable to keep track of them inside Python:
image1 = Image.fromarray( ... )
image1.save("original.png")
Image1.open("original.png")
image2 = Image.fromarray( ... )
image2.save("reconstruction.png")
Image2.open("reconstruction.png")
image1.show("image1")
image2.show("image2")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With