summaryrefslogtreecommitdiff
path: root/helper_libs
diff options
context:
space:
mode:
authorNavan Chauhan <navanchauhan@gmail.com>2023-10-22 21:31:51 -0600
committerNavan Chauhan <navanchauhan@gmail.com>2023-10-22 21:31:51 -0600
commit77bdfae24843e163052479730210177103b123aa (patch)
tree53eb4890dbc43ae1f60abe2774f65042d068d0d5 /helper_libs
parentb51c8eb0e6e37682e9f5dfa43fedfce665e9beb7 (diff)
Use Dall-E to generate images
Diffstat (limited to 'helper_libs')
-rw-r--r--helper_libs/image_utils.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/helper_libs/image_utils.py b/helper_libs/image_utils.py
index 70eaebb..501b6d0 100644
--- a/helper_libs/image_utils.py
+++ b/helper_libs/image_utils.py
@@ -20,12 +20,15 @@ class ImageText(object):
self.draw = ImageDraw.Draw(self.image)
self.encoding = encoding
- def line(self, shape, fill):
- self.draw.line(shape,fill=fill, width=10)
+ def line(self, shape, fill, width=10):
+ self.draw.line(shape,fill=fill, width=width)
def save(self, filename=None):
self.image.save(filename or self.filename)
+ def paste(self, image, coords):
+ self.image.paste(image, coords)
+
def get_font_size(self, text, font, max_width=None, max_height=None):
if max_width is None and max_height is None:
raise ValueError('You need to pass max_width or max_height')
@@ -122,4 +125,4 @@ class ImageText(object):
last_word_x = x + box_width - last_word_size[0]
self.write_text((last_word_x, height), words[-1], font_filename,
font_size, color)
- return (box_width, height - y) \ No newline at end of file
+ return (box_width, height - y)