import io
import time
import picamera
from PIL import Image

stream = io.BytesIO()

with picamera.PiCamera() as camera:

	camera.resolution(640,480)
	camera.start_preview()
	time.sleep(2)
	camera.capture(stream, format='jpeg')
	
	# "Rewind" the stream to the beginning so we can read its content
	stream.seek(0)
	image = Image.open(stream)
	print image[10,20]
	
	



import time
import picamera

with picamera.PiCamera() as camera:
    camera.start_preview()
    time.sleep(5)
    camera.capture('/home/pi/Desktop/image.jpg')
    camera.stop_preview()	
	
	
 def find_tiff_diff(self, new_tif, old_tif, out_diff_tif, compare_exe):
command = ("%s -quiet -metric AE %s %s -compose Src -highlight-color White -lowlight-color Black %s" %
(compare_exe, new_tif, old_tif, out_diff_tif))
process = subprocess.Popen(command,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
stdout = process.communicate()[0]
return int(float(stdout.strip()))
	