Picamera图片命名

时间:2016-03-08 16:32:28

标签: python-2.7 camera raspberry-pi

我遇到了picamera和python的问题。我想要做的就是获取一个变量名称,然后保存一个与.jpg文件类型连接的变量名称的图片。

import picamera
import time


camera = picamera.PiCamera()

camera.vflip = True
camera.hflip = True
itemname = raw_input ('what is the item name? ')
time.sleep(6)
camera.capture(itemname,'.jpg')
time.sleep(2)
camera.close()
print "done"

1 个答案:

答案 0 :(得分:0)

这是正确的语法

import picamera
import time


camera = picamera.PiCamera()

camera.vflip = True
camera.hflip = True
itemname = raw_input ('what is the item name? ')
time.sleep(6)
camera.capture(itemname + ".jpg")
time.sleep(2)
camera.close()
print "done"