Skip to main content

ImageProcessor

public protocol ImageProcessor 

Requirements

crop(image:​to:​)

Crop the image to a given size. The image is center-cropped

func crop(image: UIImage, to size: CGSize) -> UIImage?

Parameters

  • image: The image to crop
  • size: The size to which the image needs to be cropped

Returns

The cropped image

scale(image:​to:​)

Scale an image to a given size maintaining the aspect ratio.

func scale(image: UIImage, to size: CGSize) -> UIImage

Parameters

  • image: The image to scale
  • size: The size to which the image needs to be scaled

Returns

The scaled image

Did you find this page helpful?