Ungenutzte Hilfsfunktion, ungenutzter Konfigurationswert und drei CSS-Regeln ohne Verwendung im Markup. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -79,13 +79,3 @@ def encode_jpeg(rgb_or_bgr: np.ndarray, quality: int = 88, bgr: bool = True) ->
|
||||
Image.fromarray(array).save(buffer, format="JPEG", quality=quality, optimize=True)
|
||||
return buffer.getvalue()
|
||||
|
||||
|
||||
def fit_within(image: np.ndarray, max_edge: int) -> np.ndarray:
|
||||
height, width = image.shape[:2]
|
||||
longest = max(height, width)
|
||||
if longest <= max_edge:
|
||||
return image
|
||||
scale = max_edge / longest
|
||||
pil = Image.fromarray(image[:, :, ::-1])
|
||||
pil = pil.resize((round(width * scale), round(height * scale)), Image.LANCZOS)
|
||||
return np.asarray(pil)[:, :, ::-1].copy()
|
||||
|
||||
Reference in New Issue
Block a user