INNER CODE UNIT · Python

best_score

KennethJAllen/proper-pixel-art · proper_pixel_art/colors.py:77

    best, best_score = background_color_candidates[0], -1
    for color_candidate in background_color_candidates:
        score = min(_rgb_dist(color_candidate, c) for c in colors)
        if score > best_score:
            best, best_score = color_candidate, score
    return best


def clamp_alpha(
    image: Image.Image,
    alpha_threshold: int = ALPHA_THRESHOLD,
    mode: str = "RGB",
    background_hex: str | None = None,
    limit: int = _DEFAULTS.top_colors_limit,
    thumbnail_size: tuple[int, int] = _DEFAULTS.thumbnail_size,
    background_candidates: list[RGB] | None = None,
) -> Image.Image:
    """

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…