No thumbnail in iPhoto for images saved with UIImageWriteToSavedPhotosAlbum
My application downloads JPEG images from the web and save them to the device using UIImageWriteToSavedPhotosAlbum. All works fine except for one issue: when I browse iPhone's photo library with iPhoto, some images have no thumbnails -- an empty dashed rectangle is displayed instead. Those JPEG images application downloads are also generated by my application as a result of processing pictures either taken by device camera or picked from Photo Library. Maybe I ne开发者_如何学运维ed to do something special during image processing that will make thumbnails visible?
Try something like
UIImage * original = [UIImage imageNamed:@"sample.jpg"]; /* make image from CGRef */
NSData * imdata = UIImagePNGRepresentation ( original ); /* get PNG representation */
UIImage * png = [UIImage imageWithData:imdata]; /* wrap UIImage around PNG representation */
UIImageWriteToSavedPhotosAlbum(png,
self,
@selector(image:didFinishSavingWithError:contextInfo:),
nil);
This will convert your image to PNG, and the thumbnail will show in Photos.app.
精彩评论