Thanks in advance.
I know crop an image using CGRect value and masking .But now i want to create an app in that i will draw some shape using touches and drawRect method on a imageview and now i want to get only the part of an image within that shape only means i want to crop the original image into that shape. Is it possible to do.Do anyone have an idea about this.
1- Calculate the rectangular bounds of the shape.
2- Extract a cropped sub-image of that size (or a couple of pixels over, depending on the app’s intent).
Then you have some choices:
a- You can change every pixel outside of the shape to white (or white, or blue, or whatever)
b- You can set every pixel outside of the shape to transparent
3- Save it.
If you are really industrious you can even apply some dithering to the edge to smooth it out.