Renzo
commited on
Commit
·
b1a5d57
1
Parent(s):
c2e4a2f
Update image rendering in route_utils to use WEBP format and optimize quality
Browse files- route_utils.py +3 -3
route_utils.py
CHANGED
@@ -38,13 +38,13 @@ def generate_route_image_file(coords, start_lat, start_lon, end_lat, end_lon):
|
|
38 |
context.add_object(end_marker)
|
39 |
|
40 |
# Generate image and save to temp file
|
41 |
-
image = context.render_pillow(
|
42 |
|
43 |
# Create unique temp file path
|
44 |
-
filename = f"route_{uuid.uuid4().hex[:8]}.
|
45 |
filepath = os.path.join(TEMP_DIR, filename)
|
46 |
|
47 |
-
image.save(filepath)
|
48 |
return filepath
|
49 |
|
50 |
|
|
|
38 |
context.add_object(end_marker)
|
39 |
|
40 |
# Generate image and save to temp file
|
41 |
+
image = context.render_pillow(500, 375)
|
42 |
|
43 |
# Create unique temp file path
|
44 |
+
filename = f"route_{uuid.uuid4().hex[:8]}.webp"
|
45 |
filepath = os.path.join(TEMP_DIR, filename)
|
46 |
|
47 |
+
image.save(filepath, format='WEBP', quality=85, optimize=True)
|
48 |
return filepath
|
49 |
|
50 |
|