2

I am creating an application in which i save the thumbnails from the browser. Everything is working fine till i tend to move the directory containing this file into the other directory. It give this error:

ImageIO: CGImageRead_mapData 'open' failed '/Users/anuj/Library/Application Support/iPhone Simulator/6.1/Applications/8CD8EB07-6D62-4284-B425-087E821098BC/Library/Caches/PausedVideos/Old School vs. New School/Thumbnail' error = 2 (No such file or directory) ImageIO: CGImageRead_mapData 'open' failed '/Users/anuj/Library/Application Support/iPhone Simulator/6.1/Applications/8CD8EB07-6D62-4284-B425-087E821098BC/Library/Caches/PausedVideos/Old School vs. New School/Thumbnail' error = 2 (No such file or directory) libpng error: No IDATs written into file

Heres the code that i am using:

NSData *data = [NSData dataWithData:UIImagePNGRepresentation(video.Thumbnail)];
Thumbnail = [[UIImage imageWithData:data] retain];

I also referred to the link here but that doesn't changed anything.

Community
  • 1
  • 1
Nikhil Lihla
  • 607
  • 6
  • 21
  • Nikhil, It seems that no image data was written which you were converting. Please check with the byte length of video.Thumbnail. – Tarun Mar 06 '13 at 09:28

1 Answers1

0
NSData *data = [NSData dataWithData:UIImagePNGRepresentation(imageview.image)]
UIImage *img=[UIImage imageWithData:data];
[yourImageView setImage:img];
Rushabh
  • 3,208
  • 5
  • 28
  • 51