Created
October 25, 2020 01:39
-
-
Save laevandus/3367650ce769ede040a66805f89477ef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Scaling the full image | |
let originalImage = UIImage(named: "example_photo.jpg")! | |
var targetSize = CGSize(width: 100, height: 100) | |
imageView.image = ImageScaler.scaleToFill(originalImage, in: targetSize) | |
// Scaling only a small part of the image | |
let originalImage = UIImage(named: "example_photo.jpg")! | |
var fromRect = CGRect(x: 362.0, y: 449.0, width: 260.0, height: 160.0) | |
var targetSize = CGSize(width: 100, height: 100) | |
imageView.image = ImageScaler.scaleToFill(originalImage, in: targetSize, from: fromRect) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment