Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone:How to implement "move and scale" functionality for image fetched from photo library

As shown in the following figure I want to implement "move and scale" functionality for the image fetched from the photo library.

If you have any idea or code then provide me.

image

Thanx in advance.

like image 963
Rohan Avatar asked Feb 29 '12 09:02

Rohan


2 Answers

See this answer by Jane Sales

From The answer for this question Set dimensions for UIImagePickerController “move and scale” cropbox

The solution I recommend is to disable editing for the image picker and handle it yourself. For instance, I put the image in a scrollable, zoomable image view. On top of the image view is a fixed position "crop guide view" that draws the crop indicator the user sees. Assuming the guide view has properties for the visible rect (the part to keep) and edge widths (the part to discard) you can get the cropping rectangle like so.

Here is link for Re-sizing + UIImage

1) Link for Cropping a UIImage

2) Another link

3) More things to do with UIImage

like image 76
Krrish Avatar answered Sep 24 '22 22:09

Krrish


This is extremely late, but hopefully it'll help.

In the UIImagePickerController Delegate method imagePickerController:didFinishPickingMediaWithInfo: the "moved" and "scaled" image is accessed through the UIImagePickerControllerEditedImage key like this

 - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
 {
     UIImage *img = (UIImage *)[info objectForKey: UIImagePickerControllerEditedImage];

 // Do what you need to with that image

 }

Hope it helps someone!

like image 38
SirRupertIII Avatar answered Sep 20 '22 22:09

SirRupertIII