How to resize an image?
-
05-07-2019 - |
Question
I have taken an image from UIImagePickerController
, but the file looks too big to be transferred through internet, I'd like to resize the image. I couldn't find any method related to the image process.
Any recommendation?
Solution
You could create a context of the desired size using UIGraphicsBeginImageContext()
, then draw the image to the context using UIImage's -drawInRect:
method, and finally use UIGraphicsGetImageFromCurrentImageContext()
to pull a new UIImage back out.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow