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()))



mport sys
import Image
import ImageDraw
import ImageFont

txt = 'C\'est mon texte!'
txt2 = '??,??!'

font = ImageFont.truetype('verdanai.ttf',24)
font2 = ImageFont.truetype('simsun.ttc',24)
im = Image.new("RGBA",(300,200),(100,155,100))

draw = ImageDraw.Draw(im)

#draw.text( (0,50), u'??,??!', font=font)
draw.text( (0,50), unicode(txt,'UTF-8'), font=font)
draw.text( (0,100), unicode(txt2,'UTF-8'), font=font2)
del draw

im.save('font.png', "PNG")

http://stackoverflow.com/questions/19468020/run-server-alongside-infinite-loop-in-python

keepDiskSpaceFree(diskSpaceToReserve)
    time = datetime.now()
    filename = filepath + "/" + filenamePrefix + "-%04d%02d%02d-%02d%02d%02d.jpg" % ( time.year, time.month, time.day, time.hour, time.minute, time.second)
    subprocess.call("raspistill -w 1296 -h 972 -t 1000 -e jpg -q 15 -o %s" % filename, shell=True)
    print "Captured %s" % filename

filepath = "/home/pi/camera"
filenamePrefix = "capture"
	