ALAsset* selectedAsset = [assets objectAtIndex:index];
int byteArraySize = asset2.defaultRepresentation.size;
NSMutableData* rawData = [[NSMutableData alloc]initWithCapacity:byteArraySize];
void* bufferPointer = [rawData mutableBytes];
NSError* error=nil;
[asset2.defaultRepresentation getBytes:bufferPointer fromOffset:0 length:byteArraySize error:&error];
if (error) { NSLog(@"%@",error); }
rawData = [NSMutableData dataWithBytes:bufferPointer length:byteArraySize];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString *cachesDirectory = [paths objectAtIndex:0];
NSString* filePath = [NSString stringWithFormat:@"%@/imageTemp.png",cachesDirectory,(NSString*)[asset2 valueForProperty:@"ALAssetPropertyDate"]];
[rawData writeToFile:filePath atomically:YES];