2023-08-26 17:16:07 +03:00
|
|
|
from MockupEngineer import MockupEngineerInstance
|
|
|
|
from PIL import Image
|
|
|
|
|
|
|
|
mockup = MockupEngineerInstance()
|
|
|
|
|
|
|
|
|
|
|
|
def get_image_mokeup(image_path):
|
|
|
|
with Image.open(image_path) as img:
|
|
|
|
width, height = img.size
|
|
|
|
if width >= height:
|
|
|
|
q = mockup.generate(
|
|
|
|
template_id="4724b1349442f7fdaa60216d31cbd6a8",
|
|
|
|
screenshot_path=image_path,
|
|
|
|
color=mockup.templates[0].colors[0].color,
|
|
|
|
)
|
|
|
|
else:
|
|
|
|
q = mockup.generate(
|
2023-08-27 04:15:52 +03:00
|
|
|
template_id="d95345535d98fcc6f4030e1d3ca62052",
|
2023-08-26 17:16:07 +03:00
|
|
|
screenshot_path=image_path,
|
|
|
|
color=mockup.templates[0].colors[0].color,
|
|
|
|
)
|
|
|
|
return q
|