dgs.utils.image.compute_padding¶
- dgs.utils.image.compute_padding(old_w: int, old_h: int, target_aspect: float) list[int] [source]¶
Given the width and height of an old and image, compute the size of a padding around the old image such that the aspect ratio matches a target.
- Parameters:
old_w – Width of the old image
old_h – Height of the old image
target_aspect – Aspect the new image should have (width / height).
- Returns:
A list of integers as paddings for the left, top, right, and bottom side respectively.