Does anyone know how to crop an image (uiimage or cgimage). By cropping, I mean software cropping the opaque borders of an image. Therefore, if I have the image below:
this will give:
Sum all rows and all columns of your image. In your example, you will get two arrays:
3 1 5 0 0 1 1 3 2 1 1 0
Then the first non-zero on the left and the last next to the right is where you should crop in each direction.