Workpam commited on
Commit
b6c3095
·
verified ·
1 Parent(s): 340b4a8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
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() == 'JPG':
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() == 'JPG':
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
- ["JPG","PNG","WEBP","TIFF","GIF","JFIF","AVIF"],
645
  label="🖼️ Format",
646
- value="JPG"
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)