Exemplo n.º 1
0
def display_image(settings):
    epd = epd12in48b.EPD()
    epd.Init()
    # epd.clear()
    logging.info("Create blk img")
    Blackimage = Image.new("1", (epd12in48b.EPD_WIDTH, epd12in48b.EPD_HEIGHT),
                           255)
    logging.info("Create red img")
    Redimage = Image.new("1", (epd12in48b.EPD_WIDTH, epd12in48b.EPD_HEIGHT),
                         255)
    Blackimage = Image.open(settings["black_image"])
    Redimage = Image.open(settings["red_image"])
    logging.info("Imgs opened, displaying")
    epd.display(Blackimage, Redimage)
    logging.info("Displayed, now start sleeping")
    epd.EPD_Sleep()
    logging.info("Sleeping")
    epd = epd12in48.EPD()

elif (sys.argv[1] == 'help' or sys.argv[1] == 'HELP'):
    print('If you are using epd_12in48 please run: sudo python %s ' %
          sys.argv[0])
    print('If you are using epd_12in48B please run: sudo python %s B' %
          sys.argv[0])
    sys.exit(0)

elif (sys.argv[1] == 'B' or sys.argv[1] == 'b'):
    import epd12in48b
    print('epd12in48b')
    Color_Type = 2
    Inage_WIDTH = epd12in48b.EPD_WIDTH
    Inage_HEIGHT = epd12in48b.EPD_HEIGHT
    epd = epd12in48b.EPD()

print("Please wait, it will take some time to download the data!!!!")
##################################################
Blackimage = Image.new("1", (Inage_WIDTH, Inage_HEIGHT), 255)
Otherimage = Image.new("1", (Inage_WIDTH, Inage_HEIGHT), 255)
Black = ImageDraw.Draw(Blackimage)
Other = ImageDraw.Draw(Otherimage)
if (Color_Type == 1):
    Painting = Black
else:
    Painting = Other
##################################################


def Display_Init():