I am trying to scale a image that is being graphic programmed into the photo gallery. I am trying to scale the image to make it smaller. How would I use the code below to make the image smaller
image1.scale
I am trying to scale a image that is being graphic programmed into the photo gallery. I am trying to scale the image to make it smaller. How would I use the code below to make the image smaller
image1.scale
Use this extension to resize your image:
Basically you are calculating the aspect ratio to keep the image intact while resizing it. Then you are getting the current image context and drawing it in the specified rectangle and finally returning it as a new image.
Try this:
First Method:
Second Method:
Reference:
Here
Here
This may be helpful, this method will do proportional resizing of the image with good quality.
Call this methods like this,
Thanks:)
Swift 4 version