Resize Right is a Python library providing a single, highly flexible `resize` function for image resizing. It supports both NumPy arrays and PyTorch tensors, offering various scaling options, padding modes, and output shape controls. The current version is 0.0.2. Releases appear to be infrequent, indicating a stable, focused utility rather than a rapidly evolving project.
pip install resize-rightVerified import paths — ran on the pinned version, not inferred.
Demonstrates resizing a batch of NumPy images using both `scale_factors` and `out_shape` parameters. The library handles `(B, H, W, C)` for NumPy and `(B, C, H, W)` for PyTorch tensors.
Ensure NumPy arrays are consistently `(B, H, W, C)`. If converting from a `(B, C, H, W)` source, use `array.transpose(0, 2, 3, 1)` before passing to `resize_right.resize`.
Provide only one of `out_shape` or `scale_factors` to explicitly control the resizing behavior. If dynamic scaling is needed, calculate `out_shape` based on `scale_factors` manually and then pass only `out_shape`.
Convert input arrays to `float32` or `float64` using `array.astype(np.float32)` before resizing for optimal results and to avoid potential issues with interpolation algorithms.