Skip to content

Commit

Permalink
Fix duplicate device direction
Browse files Browse the repository at this point in the history
Fix duplicate device direction
  • Loading branch information
pkong-ds authored Jul 8, 2024
2 parents a7063bc + 74efb54 commit 72642d6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions mockup_package/mockup/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ async def mockup(location, device_id, original_img_path_list, device_info):
raise
ig.create_fit_coord_image(spec)
deviceView = str(spec["image"]).split("-")[-1].split(".")[0]
path = f"{os.path.splitext(os.path.basename(original_img_path))[0]}"
f"-{deviceView}.png"
path = (
f"{os.path.splitext(os.path.basename(original_img_path))[0]}"
+ f"-{deviceView}.png"
)
ig.create_mockup_image(device_path, device_mask_path, path)
output_img_path_list.append([path, original_img_path, deviceView])

Expand Down
4 changes: 2 additions & 2 deletions public/image_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ def save_image(imageList):
returnList = []
for image in imageList:
path = image[0]
deviceView = image[2]
my_image = Image.open(path)
my_stream = io.BytesIO()
my_image.save(my_stream, format="PNG")
binary_fc = open(path, "rb").read()
base64_utf8_str = base64.b64encode(binary_fc).decode("utf-8")
basename, ext = os.path.splitext(path)
dataurl = f"data:image/{ext};base64,{base64_utf8_str}"
returnList.append([f"img{basename}-{deviceView}", dataurl])
print(basename)
returnList.append([f"img{basename}", dataurl])
return returnList
Binary file modified public/mockup.zip
Binary file not shown.

0 comments on commit 72642d6

Please sign in to comment.