0

Through ABPersonViewController we can edit contact's photo. Then How can we access the photo info by other way? However, we got ABPerson's image data as the big original picture but not the clip photo data as the ABPersonViewController show. Then what should we do? ABPersonCopyImageData, next?

pcjbird
  • 109
  • 1
  • 8
  • possible duplicate of [How do I get the cropping frame of the address book image data?](http://stackoverflow.com/questions/3220187/how-do-i-get-the-cropping-frame-of-the-address-book-image-data) – tc. Aug 24 '10 at 14:42

1 Answers1

0

+[UIImage imageWithData:]

To scale the image, something like

UIGraphicsBeginImageContextWithOptions(size, YES, 0);
[[UIImage imageWithData:data] drawInRect:(CGRect){{0,0},size}];
UIImage * scaledImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

(assuming size is the number of "points", for iPhone 4 support)

tc.
  • 33,468
  • 5
  • 78
  • 96
  • well, [UIImage imageWithData:] got the orignal size of photo, but not the corpping sized photo. What's the matter, because of ios4? – pcjbird Jul 20 '10 at 02:49
  • Maybe, I think there are changes from ios3 to ios4. At or before ios3, we can access the clipped photo, however, since ios4, we can not. – pcjbird Aug 05 '10 at 12:07
  • Do you mean that the image is not scaled, or that it is not cropped? There's a big difference between the two. – tc. Aug 06 '10 at 16:29
  • I mean not cropped. The system image picker maybe can got the crop info, however, since the os4, we can not access the smaller cropped photo image of the contact. – pcjbird Aug 07 '10 at 05:42
  • Sorry, I see what you mean now. It's been asked before in http://stackoverflow.com/questions/3220187/ to which I've added a bounty. – tc. Aug 24 '10 at 14:42