2

I'm searching for a posibility to crop UIImages. I've found lots of examples via google how to do this, but I want to do a bit more than just croping the image.

It would be nice if the user can choose which area of the UIImage will be crop. In other languages, for example Javascript, there are many plugins to do that. I'm looking to find something like this:

http://odyniec.net/projects/imgareaselect/

Does anybody know if some similar project exists for objective-c? Thank you!

Tobias Bambullis
  • 736
  • 5
  • 17
  • 45
  • Just to throw another good category into the mix, is called NYXImagesKit, link here: https://github.com/Nyx0uf/NYXImagesKit – Luke Mar 17 '12 at 13:15

2 Answers2

6

after days of searching I found out that there is no "plugin" which is similar to ImgAreaSelect. :-(

The best thing I found was this: https://github.com/barrettj/BJImageCropper

It wasn't very hard to adapt this project to my needs: now I can choose a proportional area with min size. :-)

Tobias Bambullis
  • 736
  • 5
  • 17
  • 45
0

You could always make a black&white mask of this area and then mask the image (white area on mask will result in transparent area on masked image).

Link to nice tutorial on how to mask an image.

As an addition you could later calculate the miminum square frame that holds complete masked (cropped) image and crop the result - to get rid of excess transparent areas.

Rok Jarc
  • 18,765
  • 9
  • 69
  • 124
  • thank you for your answer. It's a nice starting point if I have to write something on my own. But I hope that somebody knows about of an existing project to solve this ;o) – Tobias Bambullis Mar 16 '12 at 00:07
  • @TobiasBambullis: i see :) there might be an existing project - not sure. If you don't find it you'll be better off splitting your problem in to several 'atomic' problems: how to dynamically generate an polygon (area of nodes) using touches; how to paint a poligon i Obj-C; how to mask an image; how to crop an image; how to save an image - that's it :) – Rok Jarc Mar 16 '12 at 09:26