Method: DynamicImage::ProcessedImage#cropped_and_resized

Defined in:
lib/dynamic_image/processed_image.rb

#cropped_and_resized(size) ⇒ Object

Crops and resizes the image. Normalization is performed as well.

Example

processed = DynamicImage::ProcessedImage.new(image)
image_data = processed.cropped_and_resized(Vector2d.new(200, 200))

Returns a binary string.



39
40
41
42
43
# File 'lib/dynamic_image/processed_image.rb', line 39

def cropped_and_resized(size)
  return crop_and_resize(size) unless record.persisted?

  find_or_create_variant(size).data
end