views:

181

answers:

2

the quality of saved image will lose when i'm using this method ...

UIImage *img=imageview1.image;
UIImageWriteToSavedPhotosAlbum(img,nil,nil,nil);
+1  A: 

I don't know how to do it in the SDK, but though the UI, if you copy + paste the image into a message, it keeps its full size. Perhaps there's some mechanism like that in the SDK (copy to clipboard)? Dunno. Hope it gives you an idea.

trenton
+2  A: 

The function


NSData * UIImageJPEGRepresentation (
   UIImage *image,
   CGFloat compressionQuality
);

enables you to get the data representation of your image for the expected compression quality (1 is best).

Then you just have to write your NSData to the file system to get the JPEG file (using writeToURL:atomically: on NSData for instance).

The same can be applied to .PNG with the UIImagePNGRepresentation.

The original doc : http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIKitFunctionReference/Reference/reference.html#//apple_ref/c/func/UIImageJPEGRepresentation

yonel
NSData* imageData = UIImagePNGRepresentation(img1); i get my picture by NSData. how to save in photos ?
Naeim