image from filename
This commit is contained in:
parent
99c68a8363
commit
9a8de0667c
@ -1,3 +1,5 @@
|
||||
0.8.3
|
||||
- draw_image with filename or PIL object
|
||||
0.8.2
|
||||
- fix background colour in Page drawing
|
||||
0.8.1
|
||||
|
@ -14,9 +14,10 @@ lcd_tft = ILI9325(240, 320, drv)
|
||||
lcd_tft.init()
|
||||
|
||||
|
||||
image_file = Image.open("assets/japan_temple_240x320.jpg")
|
||||
lcd_tft.draw_image(0, 0, image_file)
|
||||
# image_file = Image.open("assets/japan_temple_240x320.jpg")
|
||||
# lcd_tft.draw_image(0, 0, image_file)
|
||||
|
||||
numbers_image = Image.open("assets/dsp2017_101_64.png")
|
||||
# numbers_image = Image.open("assets/dsp2017_101_64.png")
|
||||
lcd_tft.transparency_color = (0, 0, 0)
|
||||
lcd_tft.draw_image(10, 10, numbers_image)
|
||||
# lcd_tft.draw_image(10, 10, numbers_image)
|
||||
lcd_tft.draw_image(10, 10, "assets/dsp2017_101_64.png")
|
||||
|
@ -1,6 +1,7 @@
|
||||
"""Area drawing algorithm"""
|
||||
import itertools
|
||||
from gfxlcd.drawing.pixel import Pixel
|
||||
from PIL import Image
|
||||
|
||||
|
||||
class Area(Pixel):
|
||||
@ -103,6 +104,8 @@ class Area(Pixel):
|
||||
|
||||
def draw_image(self, pos_x, pos_y, image):
|
||||
"""draw a PIL image"""
|
||||
if isinstance(image, str):
|
||||
image = Image.open(image)
|
||||
image_file = image.convert('RGB')
|
||||
width, height = image_file.size
|
||||
self._set_area(
|
||||
|
@ -1,6 +1,7 @@
|
||||
"""Page drawing algorithm"""
|
||||
import abc
|
||||
from gfxlcd.drawing.pixel import Pixel
|
||||
from PIL import Image
|
||||
|
||||
|
||||
class Page(Pixel, metaclass=abc.ABCMeta):
|
||||
@ -126,6 +127,8 @@ class Page(Pixel, metaclass=abc.ABCMeta):
|
||||
|
||||
def draw_image(self, pos_x, pos_y, image):
|
||||
"""draw a PIL image"""
|
||||
if isinstance(image, str):
|
||||
image = Image.open(image)
|
||||
image_file = image.convert('L')
|
||||
width, height = image_file.size
|
||||
offset_x = 0
|
||||
|
2
setup.py
2
setup.py
@ -13,7 +13,7 @@ def read(*paths):
|
||||
|
||||
setup(
|
||||
name='gfxlcd',
|
||||
version='0.8.2',
|
||||
version='0.8.3',
|
||||
description='gfxlcd is a handler for graphical lcds: ILI9328, SSD1306, NJU6450, touch panel: AD7843 @ Raspberry Pi.',
|
||||
keywords=[
|
||||
'gfxlcd', 'raspberry pi' ,'ili9328' ,'ssd1306', 'nju6450', 'lcd', 'graphical lcd', 'touch panel', 'ad7843',
|
||||
|
Loading…
Reference in New Issue
Block a user