撮影した写真に日付を入れる(タイムスタンプ) picamera

撮影した写真に日付を入れる(タイムスタンプ、写し込む) 解像度 picamera

import os,datetime as dt,time,picamera

def camera(file):
    c= picamera.PiCamera()
    #c.hflip=True
    #c.vflip=True
    #c.rotation=180
    #c.led=False      
    #c.exposure_mode= 'auto' #night beach verylong    
    #c.framerate= 15 #need 15 at max resolution
    c.resolution= (1296,972) #1920x1080,2592x1944,1296x972,1296x730,640x480  
    #c.annotate_background= picamera.Color('black')	
    c.annotate_text_size= 20 #32,6-160
    c.start_preview()
    time.sleep(5) #5 image,10 video   
    c.annotate_text= dt.datetime.now().strftime('%Y-%m-%d %a %H:%M:%S')
    c.capture(file)
    c.stop_preview()   
    c.close() #power off

now=dt.datetime.now() #2018-10-14 12:52:09.571198
dir_cam='/home/pi/cam'
dir_sub='/{0:%y%m%d%H}'.format(now) #18101412
file='{0:%y%m%d}_{0:%H%M%S}'.format(now)+'.jpg' #181014_125209.jpg

try:
    os.mkdir(dir_cam+dir_sub) #create directory
except Exception as e:
    pass #print(e) #error if exist

camera(dir_cam+dir_sub+'/'+file)