Merge branch 'refs/heads/local' into develop
This commit is contained in:
@@ -466,13 +466,11 @@ class PrintPainting(object):
|
||||
|
||||
bucket_name = print_dict['print_path_list'][0].split("/", 1)[0]
|
||||
object_name = print_dict['print_path_list'][0].split("/", 1)[1]
|
||||
image = oss_get_image(bucket=bucket_name, object_name=object_name, data_type="cv2")
|
||||
image = oss_get_image(bucket=bucket_name, object_name=object_name, data_type="PIL")
|
||||
# 判断图片格式,如果是RGBA 则贴在一张纯白图片上 防止透明转黑
|
||||
if image.shape[2] == 4:
|
||||
image_rgb = cv2.cvtColor(image, cv2.COLOR_BGRA2RGBA)
|
||||
image_pil = Image.fromarray(image_rgb)
|
||||
new_background = Image.new('RGB', image_pil.size, (255, 255, 255))
|
||||
new_background.paste(image_pil, mask=image.split()[3])
|
||||
if image.mode == "RGBA":
|
||||
new_background = Image.new('RGB', image.size, (255, 255, 255))
|
||||
new_background.paste(image, mask=image.split()[3])
|
||||
image = new_background
|
||||
print_dict['image'] = cv2.cvtColor(np.asarray(image), cv2.COLOR_RGB2BGR)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user