Method: ImageProcessing::MiniMagick.resample!

Defined in:
lib/image_processing/mini_magick.rb

.resample!(image, width, height) {|MiniMagick::Tool::Mogrify, MiniMagick::Tool::Convert| ... } ⇒ File, Tempfile

Resample the image to fit within the specified resolution while retaining the original image size.

The resulting image will always be the same pixel size as the source with an adjusted resolution dimensions.

Parameters:

  • image (MiniMagick::Image)

    the image to convert

  • width (#to_s)

    the dpi width

  • height (#to_s)

    the dpi height

Yields:

  • (MiniMagick::Tool::Mogrify, MiniMagick::Tool::Convert)

Returns:

  • (File, Tempfile)

See Also:



170
171
172
173
174
175
176
177
# File 'lib/image_processing/mini_magick.rb', line 170

def resample!(image, width, height)
  with_minimagick(image) do |img|
    img.combine_options do |cmd|
      yield cmd if block_given?
      cmd.resample "#{width}x#{height}"
    end
  end
end