|
@@ -1,7 +1,7 @@
|
|
|
import time
|
|
import time
|
|
|
from concurrent.futures import as_completed, ThreadPoolExecutor, wait
|
|
from concurrent.futures import as_completed, ThreadPoolExecutor, wait
|
|
|
import threading
|
|
import threading
|
|
|
-from .remove_bg_pixian import RemoveBgPiXian
|
|
|
|
|
|
|
+from .remove_bg_pixian import RemoveBgPiXian,Picture
|
|
|
from .other.module_online_data import GetOnlineData
|
|
from .other.module_online_data import GetOnlineData
|
|
|
from .deal_one_image import DealOneImage, DealOneImageBeforehand
|
|
from .deal_one_image import DealOneImage, DealOneImageBeforehand
|
|
|
from .other.log import MyLogger
|
|
from .other.log import MyLogger
|
|
@@ -10,7 +10,7 @@ import pandas as pd
|
|
|
import csv
|
|
import csv
|
|
|
from PIL import Image
|
|
from PIL import Image
|
|
|
from io import BytesIO
|
|
from io import BytesIO
|
|
|
-import os,requests
|
|
|
|
|
|
|
+import os,requests,io
|
|
|
def urlPilImage(url):
|
|
def urlPilImage(url):
|
|
|
yzmdata = requests.get(url)
|
|
yzmdata = requests.get(url)
|
|
|
tempIm = BytesIO(yzmdata.content)
|
|
tempIm = BytesIO(yzmdata.content)
|
|
@@ -151,11 +151,22 @@ class DealModelForm:
|
|
|
num = 0
|
|
num = 0
|
|
|
save_root_path = ""
|
|
save_root_path = ""
|
|
|
baseImages = []
|
|
baseImages = []
|
|
|
|
|
+ resize=1600#定义标准
|
|
|
for index,image_data in enumerate(self.need_cutout_images):
|
|
for index,image_data in enumerate(self.need_cutout_images):
|
|
|
num += 1
|
|
num += 1
|
|
|
save_root_path = image_data["root_path"]
|
|
save_root_path = image_data["root_path"]
|
|
|
file_path = image_data["file_path"]
|
|
file_path = image_data["file_path"]
|
|
|
- image_url = self.get_online_data.upload_pic(file_path)
|
|
|
|
|
|
|
+ original_pic = Picture(file_path)
|
|
|
|
|
+ if original_pic.x > original_pic.y:
|
|
|
|
|
+ if original_pic.x > resize:
|
|
|
|
|
+ original_pic.resize(resize)
|
|
|
|
|
+ else:
|
|
|
|
|
+ if original_pic.y > resize:
|
|
|
|
|
+ original_pic.resize_by_heigh(heigh=resize)
|
|
|
|
|
+ buffer = io.BytesIO()
|
|
|
|
|
+ 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)
|
|
baseImages.append(image_url)
|
|
|
self.need_cutout_images[index]["image_url"] = image_url
|
|
self.need_cutout_images[index]["image_url"] = image_url
|
|
|
data = {
|
|
data = {
|