class ImageProcessing::MiniMagick::Processor

def resize_and_pad(width, height, background: :transparent, gravity: "Center", **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, background: :transparent, gravity: "Center", **options)
  thumbnail("#{width}x#{height}", **options)
  magick.background color(background)
  magick.gravity gravity
  magick.extent "#{width}x#{height}"
end