UIImage
-
Returns the data for the image in a decently-sized JPEG format.
Declaration
Swift
public func dataForUpload(targetWidth: CGFloat = 1125.0, jpegCompressionQuality: CGFloat = 0.6) -> Data?
Parameters
targetWidth
the target width of the image, defaults to 1125.0 ie the largest width displayable on an iPhone (iPhone X).
jpegCompressionQuality
the JPEG compression quality, defaults to 0.6 after benchmarking results
Return Value
the data to upload for the image.