No thumbnail in iPhoto for images saved with UIImageWriteToSavedPhotosAlbum

671 views Asked by At

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 need to do something special during image processing that will make thumbnails visible?

1

There are 1 answers

1
WrightsCS On

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.