lib/carrierwave/processing/vips.rb
def resize_and_pad(width, height, background=nil, gravity='centre', alpha=nil, combine_options: {})
      width, height = resolve_dimensions(width, height)

      vips! do |builder|
        builder.resize_and_pad(width, height, background: background, gravity: gravity, alpha: alpha)
          .apply(combine_options)
      end
    end
##
# Resize the image to fit within the specified dimensions while retaining
# the original aspect ratio. If necessary, will pad the remaining area
# with the given color, which defaults to transparent (for gif and png,
# white for jpeg).
#
# See https://libvips.github.io/libvips/API/current/libvips-conversion.html#VipsCompassDirection
# for gravity options.
#
# === Parameters
#
# [width (Integer)] the width to scale the image to
# [height (Integer)] the height to scale the image to
# [background (List, nil)] the color of the background as a RGB, like [0, 255, 255], nil indicates transparent
# [gravity (String)] how to position the image
# [alpha (Boolean, nil)] pad the image with the alpha channel if supported
# [combine_options (Hash)] additional vips options to apply before resizing
#
# === Yields
#
# [Vips::Image] additional manipulations to perform
#
Resize the image to fit within the specified dimensions while retaining
the original aspect ratio. If necessary, will pad the remaining area
with the given color, which defaults to transparent (for gif and png,
white for jpeg).



Parameters



Yields

[Vips::Image] additional manipulations to perform
Resize the image to fit within the specified dimensions while retaining the original aspect ratio . If necessary will pad the remaining area with the given color which defaults to transparent ( for gif and png white for jpeg ) . Parameters Yields [ Vips :: Image ] additional manipulations to perform
def resize_and_pad(width, height, background=nil, gravity='centre', alpha=nil, combine_options: {})
      width, height = resolve_dimensions(width, height)
      vips! do |builder|
        builder.resize_and_pad(width, height, background: background, gravity: gravity, alpha: alpha)
          .apply(combine_options)
      end
    end
def resize_and_pad ( width , height , background = nil , gravity = 'centre' , alpha = nil , combine_options : { } ) width , height = resolve_dimensions ( width , height ) vips! do | builder | builder . resize_and_pad ( width , height , background : background , gravity : gravity , alpha : alpha ) . apply ( combine_options ) end end
Resize the image to fit within the specified dimensions while retaining
the original aspect ratio.
Resize the image to fit within the specified dimensions while retaining the original aspect ratio .
width
height
background
gravity
alpha
combine_options