opening a jpg file in python

Aswathy
from PIL import Image

im = Image.open('withmed.jpg',0)
im.show('image',img)
k = cv2.waitkey(0)
if k == 27:
cv2.destroyAll windows

I am trying to open a jpg image which is saved in desktop. but on running this piece of code an error is popping out

Traceback (most recent call last):
  File "/home/anusha/aswathy.py", line 5, in <module>
    cv2.imshow('image',img)
    error: /build/buildd/opencv-2.4.8+dfsg1/modules/highgui/src/window.cpp:269: 
    error: (-215) size.width>0 && size.height>0 in function imshow
Hugo

Instead of:

im = Image.open('withmed.jpg',0)

try:

im = Image.open('withmed.jpg')

If that doesn't work, put print(im) afterwards and tell us what it says.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

opening a JPG file in Google Colab

From Dev

Opening a JPG file by a script in crontab

From Dev

opening variable file in python

From Dev

Opening a JSON file in python

From Dev

Opening a JSON file in python

From Dev

opening and reading file in python with variable

From Dev

Error in opening of file. Python

From Dev

Opening txt file in a label in Python

From Dev

Trigger a python program on opening a file

From Dev

opening a file without an extension python

From Dev

Opening custom file types in cxFreeze compiled python executable on opening file

From Dev

opening & closing file without file object in python

From Dev

opening & closing file without file object in python

From Dev

Python file size without opening file

From Dev

Scrape a jpg file on webpage, then saving it using python

From Dev

Scrape a jpg file on webpage, then saving it using python

From Dev

python writing jpg files into a new html file

From Dev

Opening text file in python as an array or list of list

From Dev

python get all file descriptor opening with socket

From Dev

Opening a space(?) delimited text file in python 2.7?

From Dev

opening file odd error in python 3

From Dev

Opening a gzip file in python Apache Beam

From Dev

Special shell characters when opening in a file Python

From Dev

opening and writing a large binary file python

From Dev

opening a file in "a+" mode in python 2.7

From Dev

Error - Python - Mac - Opening file with addition of strings

From Dev

What is the purpose of [] operator while opening a file in python

From Dev

Python: Opening a file within a print() function

From Dev

Python - Opening a File in a Text Editor with Minimal Imports

Related Related

HotTag

Archive