jax.image.resize#
- jax.image.resize(image, shape, method, antialias=True, precision=Precision.HIGHEST)[source]#
Image resize.
The
methodargument expects one of the following resize methods:ResizeMethod.NEAREST,"nearest"Nearest neighbor interpolation. The values of
antialiasandprecisionare ignored.ResizeMethod.LINEAR,"linear","bilinear","trilinear","triangle"Linear interpolation. If
antialiasisTrue, uses a triangular filter when downsampling.ResizeMethod.CUBIC,"cubic","bicubic","tricubic"Cubic interpolation, using the Keys cubic kernel.
ResizeMethod.LANCZOS3,"lanczos3"Lanczos resampling, using a kernel of radius 3.
ResizeMethod.LANCZOS5,"lanczos5"Lanczos resampling, using a kernel of radius 5.
- Parameters:
image – a JAX array.
shape (core.Shape) – the output shape, as a sequence of integers with length equal to the number of dimensions of image. Note that
resize()does not distinguish spatial dimensions from batch or channel dimensions, so this includes all dimensions of the image. To represent a batch or a channel dimension, simply leave that element of the shape unchanged.method (str | ResizeMethod) – the resizing method to use; either a
ResizeMethodinstance or a string. Available methods are: LINEAR, LANCZOS3, LANCZOS5, CUBIC.antialias (bool) – should an antialiasing filter be used when downsampling? Defaults to
True. Has no effect when upsampling.
- Returns:
The resized image.