Skip to content

Commit

Permalink
Improve PNG support for certificate
Browse files Browse the repository at this point in the history
  • Loading branch information
VGR6479 authored Aug 27, 2023
1 parent 073b33f commit 883ffac
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions gerobug_dashboard/gerocert/gerocert.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ def create_cert(name: str, certificate: str, severity):
# OFFICER SIGNATURE
SIGNATURE = Image.open(signature_path)
SIGNATURE = SIGNATURE.resize((int(image_width*20/100),int(image_height*15/100)),Image.Resampling.LANCZOS)
img.paste(SIGNATURE, (int(x_name-10), int(y_name-(SIGNATURE.height+50))))


# VALIDATE FORMAT
file_mime_type = magic.from_file(signature_path, mime=True)
if file_mime_type == "image/png":
Expand Down Expand Up @@ -123,4 +122,4 @@ def generate_sample():
CERTIFICATE = create_cert("John Doe", TEMPLATE_CERT, 10)

sample_path = os.path.join(BASE_DIR,'static/templates',"Sample_Cert.jpg")
CERTIFICATE.save(sample_path, format='JPEG')
CERTIFICATE.save(sample_path, format='JPEG')

0 comments on commit 883ffac

Please sign in to comment.