mirror of
https://github.com/vladmandic/automatic
synced 2026-09-18 00:34:33 +02:00
@@ -313,7 +313,7 @@ def draw_bounding_boxes(image: Image.Image, detections: list, points: list | Non
|
||||
# Try to load a font, fall back to default if unavailable
|
||||
try:
|
||||
font_size = max(12, int(min(width, height) * 0.02))
|
||||
font_path = shared.opts.font or os.path.join(script_path, "ui", "fonts", "notosans-nerdfont-regular.ttf")
|
||||
font_path = shared.opts.font or os.path.join(script_path, "ui", "css", "ubuntu-nerdfont.ttf")
|
||||
font = ImageFont.truetype(font_path, size=font_size)
|
||||
except Exception:
|
||||
font = ImageFont.load_default()
|
||||
|
||||
@@ -146,9 +146,9 @@ class GridAnnotation:
|
||||
|
||||
def get_font(fontsize: float):
|
||||
try:
|
||||
return ImageFont.truetype(shared.opts.font or os.path.join(script_path, "ui", "fonts", "notosans-nerdfont-regular.ttf"), fontsize)
|
||||
return ImageFont.truetype(shared.opts.font or os.path.join(script_path, "ui", "css", "ubuntu-nerdfont.ttf"), fontsize)
|
||||
except Exception:
|
||||
return ImageFont.truetype(os.path.join(script_path, "ui", "fonts", "notosans-nerdfont-regular.ttf"), fontsize)
|
||||
return ImageFont.truetype(os.path.join(script_path, "ui", "css", "ubuntu-nerdfont.ttf"), fontsize)
|
||||
|
||||
|
||||
def draw_grid_annotations(im: Image.Image, width: int, height: int, x_texts: list[list[GridAnnotation]], y_texts: list[list[GridAnnotation]], margin=0, title: list[GridAnnotation] | None = None):
|
||||
|
||||
@@ -116,8 +116,6 @@ def api_progress(req: ProgressRequest):
|
||||
try:
|
||||
buffered = io.BytesIO()
|
||||
shared.state.current_image.save(buffered, format='jpeg', quality=60)
|
||||
fn = f'/tmp/preview-{shared.state.preview_job}-{shared.state.current_image_sampling_step}.jpg'
|
||||
shared.state.current_image.save(fn, quality=90)
|
||||
b64 = base64.b64encode(buffered.getvalue())
|
||||
live_preview = f'data:image/jpeg;base64,{b64.decode("ascii")}'
|
||||
except Exception:
|
||||
|
||||
Reference in New Issue
Block a user