cddb07a176
build container image / cpu (push) Waiting to run
build container image / cuda (push) Waiting to run
build container image / rocm (push) Waiting to run
frontend tests / frontend-tests (push) Waiting to run
openapi checks / openapi-checks (push) Waiting to run
python tests / py3.12: macos-default (push) Waiting to run
python tests / py3.11: windows-cpu (push) Waiting to run
python tests / py3.12: windows-cpu (push) Waiting to run
python tests / py3.11: linux-cpu (push) Waiting to run
python tests / py3.12: linux-cpu (push) Waiting to run
typegen checks / typegen-checks (push) Waiting to run
uv lock checks / uv-lock-checks (push) Waiting to run
frontend checks / frontend-checks (push) Waiting to run
lfs checks / lfs-check (push) Waiting to run
python checks / python-checks (push) Waiting to run
python tests / py3.11: macos-default (push) Waiting to run
docs / deploy (push) Has been cancelled
docs / changes (push) Has been cancelled
docs / check-and-build (push) Has been cancelled
17 lines
468 B
Python
17 lines
468 B
Python
import os
|
|
|
|
from PIL import Image
|
|
|
|
|
|
def get_thumbnail_name(image_name: str) -> str:
|
|
"""Formats given an image name, returns the appropriate thumbnail image name"""
|
|
thumbnail_name = os.path.splitext(image_name)[0] + ".webp"
|
|
return thumbnail_name
|
|
|
|
|
|
def make_thumbnail(image: Image.Image, size: int = 256) -> Image.Image:
|
|
"""Makes a thumbnail from a PIL Image"""
|
|
thumbnail = image.copy()
|
|
thumbnail.thumbnail(size=(size, size))
|
|
return thumbnail
|