Maybe be the content is not actually synced to the disk. try Image.open(open("path/to/file", 'rb'))
python - How do i read image using PILLOW image? - Stack Overflow
Python-pillow: problem with Image.open()
PIL Image Close Method Not Working?
Does open() uses PIL or Pillow when opening image files?
Videos
you can simply do
from PIL import Image
image = Image.open("D:\\YY_Aadhi\\HED-BSDS\\test\\2018.jpg")
or
from PIL import Image
directory = "D:\\YY_Aadhi\\HED-BSDS\\test\\2018.jpg"
image = Image.open(directory)
like this.
you have to write escape sequence twice in windows, when you want to define as directory. and It will be great if you try some stupid code. It helps you a lot.
Does this image = Image.open("D:\YY_Aadhi\HED-BSDS\test\2018.jpg") not do the trick?
» pip install pillow
I really searched the web and tried different paths and images but I don't see the mistake I made.
I want to build a simple GUI with tkinter and I want to show an Image in a Label. Therefore first of all I want to read in the image which is in the same folder as my python file. Maybe someone can have a look and give me a hint.
from tkinter import *
import os
from PIL import ImageTk, Image
root = Tk()
root.title("Image Collector")
#Default Settings(Variables)
status_start_stop = False
img_save_to_path = "test/"
test_img = ImageTk.PhotoImage(Image.open("test.png")) #this one is the line which causes the error
.... (there is more unproblematic code)
output:
FileNotFoundError: [Errno 2] No such file or directory: 'test.png'
The file exists in the same folder as the programm and the name is definitly correct. I copied and pasted it like a 1000 times and also tried different images. I tried creating a subfolder called images and tried to call Image.open("images/test.png") but that didn't work either.
PS: I run an Ubuntu based distribution if that is needed