class ImageProcessing::Vips::Processor

def resize_and_pad(width, height, gravity: "centre", extend: nil, background: nil, alpha: nil, **options)

the remaining area with the specified background color.
Resizes the image to fit within the specified dimensions and fills
def resize_and_pad(width, height, gravity: "centre", extend: nil, background: nil, alpha: nil, **options)
  image = thumbnail(width, height, **options)
  image = image.add_alpha if alpha && !image.has_alpha?
  image.gravity(gravity, width, height, extend: extend, background: background)
end