title: Memory issue in using UIImagePNGRepresentation
body: <p>I found this module to be troublesome. I import more than 100 images from Photolibrary, save them in documents directory with a different name. As expected I had a memory issue in the unusual place. It seems UIImagePNGRepresenation is caching files. So when I run the below process for 300+ images, I see &quot;Overall bytes&quot; in the range of 3.00 GB and crashes due to Memory (tested in allocations tool). I have pasted the code below. Is there any alternative for this code</p>
  <pre><code>-(void)something
  {
     NSData *data=nil;
     for (int i=0; i&lt;numberOfImages; i++) {
      
      @autoreleasepool {
          
          UIImage *image=[UIImage imageNamed:[NSString stringWithFormat:@&quot;image%d.png&quot;,i]];
          NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
          
          NSString *documentsDirectory = [[paths objectAtIndex:0] stringByAppendingString:@&quot;directoryname&quot;];
          
          NSString *fullPath = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@&quot;image%d.png&quot;,i]];
          
          //convert image into .png format
          data=UIImagePNGRepresentation(image);
          [data writeToURL:[NSURL URLWithString:fullPath] atomically:NO];
        }
     }
     data=nil;
  }
  </code></pre>