EDIT : In iOS7, you can use NSData's base64EncodedStringWithOptions
Now encode as:
- (NSString *)encodeToBase64String:(UIImage *)image {
return [UIImagePNGRepresentation(image) base64EncodedStringWithOptions:NSDataBase64EncodingEndLineWithCarriageReturn];
}
Decode as: