Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions image-gen/src/entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from urllib.parse import parse_qs, urlparse

from PIL import Image, ImageDraw, ImageFont
from pyodide.ffi import to_js
from workers import Request, Response, WorkerEntrypoint


Expand Down Expand Up @@ -321,10 +320,8 @@ def image_to_response(self, image: Image.Image, content_type: str) -> Response:
image_bytes = buffer.getvalue()

# Create and return response with appropriate headers
#
# TODO: This currently performs an unnecessary copy, need to fix.
return Response(
to_js(image_bytes).buffer,
image_bytes,
headers={
"Content-Type": content_type,
"Cache-Control": "public, max-age=3600",
Expand Down
2 changes: 1 addition & 1 deletion image-gen/wrangler.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "node_modules/wrangler/config-schema.json",
"name": "python-image-gen",
"main": "src/entry.py",
"compatibility_date": "2025-11-02",
"compatibility_date": "2026-09-08",
"compatibility_flags": [
"python_workers"
],
Expand Down
Loading