machineboy
machineboy

Reputation: 321

Can you save PNG's to the photo library in iOS5?

I've noticed that line drawings from the drawing app I'm making are very low quality when saved using this code:

UIImage *imageToSave = drawImage.image;
UIImageWriteToSavedPhotosAlbum(imageToSave, nil, nil, nil);

As far as I can understand, you can't set the JPG quality when using UIImageWriteToSavedPhotosAlbum.

Is there a way to save the UIImage as a PNG to the photo library directly, or some way to increase the JPG quality? When doing a screenshot (pressing on/off+home on the iPad) the quality of the grabbed picture is perfect, but I can't expect people to save images that way.

Any help greatly appreciated!

Upvotes: 3

Views: 3393

Answers (1)

Źirk Kelevra
Źirk Kelevra

Reputation: 300

Try this

NSData* pngdata = UIImagePNGRepresentation (drawImage.image); //PNG wrap 
UIImage* img = [UIImage imageWithData:pngdata];
UIImageWriteToSavedPhotosAlbum(img, nil, nil, nil);

Upvotes: 6

Related Questions