From 77bdfae24843e163052479730210177103b123aa Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Sun, 22 Oct 2023 21:31:51 -0600 Subject: Use Dall-E to generate images --- helper_libs/image_utils.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'helper_libs') 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) -- cgit v1.2.3