Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -347,7 +347,7 @@ def resize_and_save_worker(args):
|
|
347 |
img = img.convert('RGBA')
|
348 |
bg = Image.new('RGBA', img.size, (255,255,255,255))
|
349 |
img = Image.alpha_composite(bg, img)
|
350 |
-
if fmt.upper() == '
|
351 |
img = img.convert('RGB')
|
352 |
img = resize_with_padding(img, w, h)
|
353 |
out_name = f"{name}.{fmt.lower()}"
|
@@ -381,7 +381,7 @@ def process_and_zip(items, fmt, w, h):
|
|
381 |
bg = Image.new('RGBA', img.size, (255, 255, 255, 255))
|
382 |
img = Image.alpha_composite(bg, img)
|
383 |
|
384 |
-
if fmt.upper() == '
|
385 |
img = img.convert('RGB')
|
386 |
|
387 |
img = resize_with_padding(img, w, h)
|
@@ -641,9 +641,9 @@ with gr.Blocks(css=css) as demo:
|
|
641 |
with gr.Group(elem_classes="panel"):
|
642 |
with gr.Row():
|
643 |
format_choice = gr.Dropdown(
|
644 |
-
["
|
645 |
label="🖼️ Format",
|
646 |
-
value="
|
647 |
)
|
648 |
width = gr.Number(label="Width (px)", value=1000, precision=0)
|
649 |
height = gr.Number(label="Height (px)", value=1000, precision=0)
|
|
|
347 |
img = img.convert('RGBA')
|
348 |
bg = Image.new('RGBA', img.size, (255,255,255,255))
|
349 |
img = Image.alpha_composite(bg, img)
|
350 |
+
if fmt.upper() == 'JPEG':
|
351 |
img = img.convert('RGB')
|
352 |
img = resize_with_padding(img, w, h)
|
353 |
out_name = f"{name}.{fmt.lower()}"
|
|
|
381 |
bg = Image.new('RGBA', img.size, (255, 255, 255, 255))
|
382 |
img = Image.alpha_composite(bg, img)
|
383 |
|
384 |
+
if fmt.upper() == 'JPEG':
|
385 |
img = img.convert('RGB')
|
386 |
|
387 |
img = resize_with_padding(img, w, h)
|
|
|
641 |
with gr.Group(elem_classes="panel"):
|
642 |
with gr.Row():
|
643 |
format_choice = gr.Dropdown(
|
644 |
+
["JPEG","PNG","WEBP","TIFF","GIF","JFIF","AVIF"],
|
645 |
label="🖼️ Format",
|
646 |
+
value="JPEG"
|
647 |
)
|
648 |
width = gr.Number(label="Width (px)", value=1000, precision=0)
|
649 |
height = gr.Number(label="Height (px)", value=1000, precision=0)
|