PreUploadProcessor

public struct PreUploadProcessor

A processor containing useful utils before uploading an image on a server.

  • Creates a new processor.

    Declaration

    Swift

    public init()
  • Resizes an image to a target width using a Lanczos filter from Core Image.

    The returned image comes from a Core Graphics image version (as opposed to Core Image) so that it can also be compressed via UIImageJPEGRepresentation or UIImagePNGRepresentation.

    Declaration

    Swift

    public func resizeImage(_ image: UIImage, targetWidth: CGFloat) -> UIImage?

    Parameters

    image

    an image you want to resize.

    targetWidth

    the target width of the returned image.

    Return Value

    an image of the desired width if the resizing was successful, nil otherwise.

  • Resizes an image to a target width using a basic Core Graphics rendering.

    Declaration

    Swift

    public func cheapResizeImage(_ image: UIImage, targetWidth: CGFloat) -> UIImage?

    Parameters

    image

    an image you want to resize.

    targetWidth

    the target width of the returned image.

    Return Value

    an image of the desired width if the resizing was successful, nil otherwise.