스토리 이미지 생성 기능 추가 및 관련 코드 수정
This commit is contained in:
parent
60011917bc
commit
8bc993d8d8
3 changed files with 28 additions and 5 deletions
|
|
@ -64,6 +64,29 @@ def 얻기(MLSV_YMD:str):
|
|||
|
||||
print("🍲 | Meal Info Image Saved")
|
||||
|
||||
def 스토리_얻기(MLSV_YMD:str):
|
||||
# 1:1 to 9:16 temp/{MLSV_YMD}.png
|
||||
|
||||
사진 = Image.open(f"{ROOT}temp/{MLSV_YMD}.png")
|
||||
가로, 세로 = 사진.size
|
||||
비율 = 9 / 16
|
||||
가로_비율 = 가로 / 세로
|
||||
if 가로_비율 < 비율:
|
||||
새_가로 = int(세로 * 비율)
|
||||
새_세로 = 세로
|
||||
새_사진 = Image.new("RGB", (새_가로, 새_세로), (10, 10, 10))
|
||||
사진 = 사진.resize((int(가로 * 0.85), int(세로 * 0.85)), Image.LANCZOS)
|
||||
새_사진.paste(사진, (int((새_가로 - 사진.width) / 2), int((새_세로 - 사진.height) / 2)))
|
||||
else:
|
||||
새_가로 = 가로
|
||||
새_세로 = int(가로 / 비율)
|
||||
새_사진 = Image.new("RGB", (새_가로, 새_세로), (10, 10, 10))
|
||||
사진 = 사진.resize((int(가로 * 0.85), int(세로 * 0.85)), Image.LANCZOS)
|
||||
새_사진.paste(사진, (int((새_가로 - 사진.width) / 2), int((새_세로 - 사진.height) / 2)))
|
||||
|
||||
새_사진.save(f'temp/{MLSV_YMD}-story.png')
|
||||
print("🍲 | Story Info Image Saved")
|
||||
|
||||
def 디스코드(MLSV_YMD:str):
|
||||
|
||||
오늘급식 = 급식_정보_얻기(MLSV_YMD)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue