Ad
Python Display Image - AttributeError
Hi I just got a Raspberry Pi, and I'm working on some very simple code here. What I'm trying to do is to capture an image and display it.
import PIL
import Image
import picamera
camera = picamera.PiCamera()
camera.capture("image.jpg")
im = Image.open("image.jpg")
im.show()
There was no error, but the image would not show up.
I checked the file, the picture was taken, so no problem on that part of the code.
Would really like some help, thanks!
Ad
Answer
Python is case-sensitive. You are importing Image
so use it.
Change image
to Image
in im = image("image.jpg")
It'll become:
from PIL import Image
import picamera
camera = picamera.PiCamera()
camera.capture("image.jpg")
im = Image.open("image.jpg")
im.show()
Ad
source: stackoverflow.com
Related Questions
- → What are the pluses/minuses of different ways to configure GPIOs on the Beaglebone Black?
- → Django, code inside <script> tag doesn't work in a template
- → React - Django webpack config with dynamic 'output'
- → GAE Python app - Does URL matter for SEO?
- → Put a Rendered Django Template in Json along with some other items
- → session disappears when request is sent from fetch
- → Python Shopify API output formatted datetime string in django template
- → Can't turn off Javascript using Selenium
- → WebDriver click() vs JavaScript click()
- → Shopify app: adding a new shipping address via webhook
- → Shopify + Python library: how to create new shipping address
- → shopify python api: how do add new assets to published theme?
- → Access 'HTTP_X_SHOPIFY_SHOP_API_CALL_LIMIT' with Python Shopify Module
Ad