Selaa lähdekoodia

Merge remote-tracking branch 'origin/master' into dev-frontend

panqiuyao 11 kuukautta sitten
vanhempi
commit
022f5df75a
1 muutettua tiedostoa jossa 6 lisäystä ja 1 poistoa
  1. 6 1
      python/services/deal_cutout.py

+ 6 - 1
python/services/deal_cutout.py

@@ -191,7 +191,10 @@ class DealModelForm:
                 if original_pic.y > resize:
                     original_pic.resize_by_heigh(heigh=resize)
             buffer = io.BytesIO()
-            original_pic.im.save(buffer, format="JPEG")
+            if original_pic.im.mode == "RGBA":
+                original_pic.im.save(buffer, format="PNG")
+            else:
+                original_pic.im.save(buffer, format="JPEG")
             buffer.seek(0)
             image_url = self.get_online_data.upload_pic(file_path=None, buffer=buffer)
             baseImages.append(image_url)
@@ -247,6 +250,8 @@ class DealModelForm:
         failCount = 0
         is_finished = False
         root_path = ""
+        if generate_ids is None:
+            raise UnicornException("参数异常")
         if len(generate_ids) > 0:
             print("generate_ids", generate_ids)
             root_path = generate_ids[0]["root_path"]