Start a Project

Cropping Image In Swift

Hello guys, Today we will learn about how to “Cropping Image In Swift” IOS.

Overview Of Cropping Image :-

In this blog, we are going to implement the functionality of “Cropping Image”.

when we use an image picker we only take selected images we couldn’t crop the image according to our need and we couldn’t rotate our image. To overcome this problem we use the crop image functionality.

For this functionality, we need to download a pod file

How to install pod file – we need to follow some steps

  1. open your xCode project in terminal
  2. write pod init -> Enter
  3. writre pod install -> Enter
  4. wrtie pod file name like below image

5. write pod install -> Enter

Now open your .xcworkspace project into your Xcode

Now open viewController Class and write some code for upload images from the gallery.

you need to call the “import QCropper” module in the top

After that, you need to call the image Picker method

when the image picker method is called we need to call crop Image Functionality inside the image picker controller method

After that, we need to call the delegate function of cropper Image functionality

Here is the full code of the functionality

Now run your code:- Input

https://mobikul.com/wp-content/uploads/2021/07/Screen-Recording-2021-07-23-at-2.59.35-PM.mov

Conclusion:-

In this blog, we discussed how to crop the image

I hope this blog will help you to get about Cropping Image In Swift functionality

Thanks for reading!!

Exit mobile version