From d59303f7864e0c42e097f0b62cfb59c6fdd89924 Mon Sep 17 00:00:00 2001 From: LinuxGuy312 <101087324+LinuxGuy312@users.noreply.github.com> Date: Wed, 20 Sep 2023 13:33:52 +0530 Subject: [PATCH 1/4] Update Code to Pillow 10.0.0 --- phlogo/__init__.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/phlogo/__init__.py b/phlogo/__init__.py index d0b52e0..84c729a 100644 --- a/phlogo/__init__.py +++ b/phlogo/__init__.py @@ -18,16 +18,18 @@ def gabung(arg): im,text1=add_corners(arg[0], 17),arg[1] op=Image.new("RGB",(40,20),color=(0,0,0)) draw=ImageDraw.Draw(op) - size=font.getsize(text1) - baru=Image.new("RGB",(im.width+size[0]+210+20+130,600), color=(0,0,0)) + size=font.getlength(text1) + baru=Image.new("RGB",(im.width+size+210+20+130,600), color=(0,0,0)) draw=ImageDraw.Draw(baru) draw.text((150,250), text1,(255,255,255),font=font) - baru.paste(im, (150+size[0]+20,230+10), im.convert("RGBA")) + baru.paste(im, (150+size+20,230+10), im.convert("RGBA")) return baru return gabung(fun) def generate(text1, text2): - panjangText=font.getsize(text2) - oren=Image.new("RGBA",(panjangText[0]+20,140),color=(240, 152, 0)) + panjangTextBbox=font.getbbox(text2) + panjangTextLength=font.getlength(text2) + panjangTextHeight=pajangTextBbox[3]-pajanjTextBbox[1] + oren=Image.new("RGBA",(panjangTextLength+20,140),color=(240, 152, 0)) draw=ImageDraw.Draw(oren) - draw.text((10,int((oren.height-panjangText[1])/2)-10),text2, (0,0,0),font=font) - return Gabung([oren, text1]) \ No newline at end of file + draw.text((10,int((oren.height-panjangTextHeight)/2)-10),text2, (0,0,0),font=font) + return Gabung([oren, text1]) From ce9af6cf27a327e1f7eb48d7a7f00e769894742f Mon Sep 17 00:00:00 2001 From: LinuxGuy312 <101087324+LinuxGuy312@users.noreply.github.com> Date: Wed, 20 Sep 2023 13:40:44 +0530 Subject: [PATCH 2/4] Typo --- phlogo/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phlogo/__init__.py b/phlogo/__init__.py index 84c729a..416decc 100644 --- a/phlogo/__init__.py +++ b/phlogo/__init__.py @@ -28,7 +28,7 @@ def gabung(arg): def generate(text1, text2): panjangTextBbox=font.getbbox(text2) panjangTextLength=font.getlength(text2) - panjangTextHeight=pajangTextBbox[3]-pajanjTextBbox[1] + panjangTextHeight=pajangTextBbox[3]-pajangTextBbox[1] oren=Image.new("RGBA",(panjangTextLength+20,140),color=(240, 152, 0)) draw=ImageDraw.Draw(oren) draw.text((10,int((oren.height-panjangTextHeight)/2)-10),text2, (0,0,0),font=font) From ef34e1ef6efba8c150cdb201c9777a0b4faaa8c8 Mon Sep 17 00:00:00 2001 From: LinuxGuy312 <101087324+LinuxGuy312@users.noreply.github.com> Date: Wed, 20 Sep 2023 13:42:48 +0530 Subject: [PATCH 3/4] Another One --- phlogo/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phlogo/__init__.py b/phlogo/__init__.py index 416decc..bacdc5a 100644 --- a/phlogo/__init__.py +++ b/phlogo/__init__.py @@ -28,7 +28,7 @@ def gabung(arg): def generate(text1, text2): panjangTextBbox=font.getbbox(text2) panjangTextLength=font.getlength(text2) - panjangTextHeight=pajangTextBbox[3]-pajangTextBbox[1] + panjangTextHeight=panjangTextBbox[3]-panjangTextBbox[1] oren=Image.new("RGBA",(panjangTextLength+20,140),color=(240, 152, 0)) draw=ImageDraw.Draw(oren) draw.text((10,int((oren.height-panjangTextHeight)/2)-10),text2, (0,0,0),font=font) From aa40c97edfcfec899db2b40563385497abe241b7 Mon Sep 17 00:00:00 2001 From: LinuxGuy312 <101087324+LinuxGuy312@users.noreply.github.com> Date: Wed, 20 Sep 2023 13:58:34 +0530 Subject: [PATCH 4/4] Check and Updated, No errors --- phlogo/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phlogo/__init__.py b/phlogo/__init__.py index bacdc5a..b98149d 100644 --- a/phlogo/__init__.py +++ b/phlogo/__init__.py @@ -18,7 +18,7 @@ def gabung(arg): im,text1=add_corners(arg[0], 17),arg[1] op=Image.new("RGB",(40,20),color=(0,0,0)) draw=ImageDraw.Draw(op) - size=font.getlength(text1) + size=round(font.getlength(text1)) baru=Image.new("RGB",(im.width+size+210+20+130,600), color=(0,0,0)) draw=ImageDraw.Draw(baru) draw.text((150,250), text1,(255,255,255),font=font) @@ -27,8 +27,8 @@ def gabung(arg): return gabung(fun) def generate(text1, text2): panjangTextBbox=font.getbbox(text2) - panjangTextLength=font.getlength(text2) - panjangTextHeight=panjangTextBbox[3]-panjangTextBbox[1] + panjangTextLength=round(font.getlength(text2)) + panjangTextHeight=(round(panjangTextBbox[3])+10)-round(panjangTextBbox[1]) oren=Image.new("RGBA",(panjangTextLength+20,140),color=(240, 152, 0)) draw=ImageDraw.Draw(oren) draw.text((10,int((oren.height-panjangTextHeight)/2)-10),text2, (0,0,0),font=font)