mirror of
https://github.com/ae-utbm/sith.git
synced 2025-04-16 11:00:21 +00:00
15 lines
522 B
Python
15 lines
522 B
Python
from django.core.management.base import BaseCommand
|
|
from PIL import Image
|
|
|
|
|
|
class Command(BaseCommand):
|
|
def add_arguments(self, parser):
|
|
parser.add_argument("--numero", type=int)
|
|
parser.add_argument("--path", type=str)
|
|
|
|
def handle(self, *args, **options):
|
|
if options["path"] and options["numero"]:
|
|
im = Image.open(options["path"]).resize((120, 120)).convert("RGBA")
|
|
im.save(f"core/static/core/img/promo_{options['numero']}.png", format="PNG")
|
|
im.close()
|