In my iOS app, I have to make some modification on a UIImage, for example adding a watermark on it. After that, I want to save the image with original meta data, but if I tried to using writeImageDataToSavedPhotosAlbum:metadata:completionBlock:, I got nothing in the produced image.
Since I have to modify the image, so I have to pass the NSData for metadata: part using the following method: UIImageJPEGRepresentation(UIImage *, float).
And right before saving the image, the meta data is like:
Meta: {
ApertureValue = "2.526068811667587";
BrightnessValue = "-1.807443054797895";
ExposureMode = 0;
ExposureProgram = 2;
ExposureTime = "0.05882352941176471";
FNumber = "2.4";
Flash = 16;
FocalLenIn35mmFilm = 33;
FocalLength = "4.12";
ISOSpeedRatings = (
800
);
LensMake = Apple;
LensModel = "iPhone 5c back camera 4.12mm f/2.4";
LensSpecification = (
"4.12",
"4.12",
"2.4",
"2.4"
);
MeteringMode = 3;
PixelXDimension = 3264;
PixelYDimension = 2448;
SceneType = 1;
SensingMethod = 2;
ShutterSpeedValue = "4.058917734171294";
WhiteBalance = 0;
"{GPS}" = {
Altitude = "147.9932";
DOP = "76.42908";
Latitude = "45.7398";
LatitudeRef = N;
Longitude = "126.6266";
LongitudeRef = E;
TimeStamp = "2013:12:23 08:45:30";
};
So, what is wrong here?
Try this,
UIImage *newImage = self.yourOriginalImage;
UIImage *anotherImage = #"waterMark.png";
CGImageRef imageRef = anotherImage.CGImage;
CGImageRef mask = CGImageMaskCreate(CGImageGetWidth(imageRef),
CGImageGetHeight(imageRef),
CGImageGetBitsPerComponent(imageRef),
CGImageGetBitsPerPixel(imageRef),
CGImageGetBytesPerRow(imageRef),
CGImageGetDataProvider(imageRef), NULL, false);
CGImageRef maskedImage = CGImageCreateWithMask([newImage CGImage], mask);
self.imageView.image = [UIImage imageWithCGImage: maskedImage];
Assuming you have a UIImage called myEditedImage and the metadata in an NSDictionary (or an NSMutableDictionary...) called "metadata":
ALAssetsLibrary *library;
ALAssetsLibraryWriteImageCompletionBlock completionBlock = ^(NSURL *assetURL, NSError *error) {};
float compressionLevel = 0.75; // Or whatever you want
NSData *dataIn = UIImageJPEGRepresentation(myEditedImage, compressionLevel);
[library writeImageDataToSavedPhotosAlbum: dataIn
metadata: metadata
completionBlock:completionBlock];
Related
I can get the location information from photo album on ios, but I would like to access image location (latitude and longitude) when I took a photo.
so this is image finished event
public override void FinishedPickingMedia(UIImagePickerController picker, NSDictionary info)
{
//UIImagePickerController.ReferenceUrl
var originalImage = new NSString("UIImagePickerControllerOriginalImage");
var image = (UIImage)info[originalImage];
foreach (var item in info)
Console.WriteLine(item.Key + " " + item.Value);
image.SaveToPhotosAlbum(delegate(UIImage img, NSError err)
{
Console.WriteLine("Saved!");
});
_dp.DismissModalViewController(true);
OnImageChoosed(image);
}
}
and in info dictionary, i can see those properties
UIImagePickerControllerMediaMetadata {
DPIHeight = 72;
DPIWidth = 72;
Orientation = 6;
"{Exif}" = {
ApertureValue = "2.27500704749987";
BrightnessValue = "5.267792568433492";
ColorSpace = 1;
DateTimeDigitized = "2015:07:08 14:24:15";
DateTimeOriginal = "2015:07:08 14:24:15";
ExposureBiasValue = 0;
ExposureMode = 0;
ExposureProgram = 2;
ExposureTime = "0.008333333333333333";
FNumber = "2.2";
Flash = 24;
FocalLenIn35mmFilm = 29;
FocalLength = "4.15";
ISOSpeedRatings = (
40
);
LensMake = Apple;
LensModel = "iPhone 6 back camera 4.15mm f/2.2";
LensSpecification = (
"4.15",
"4.15",
"2.2",
"2.2"
);
MeteringMode = 5;
PixelXDimension = 3264;
PixelYDimension = 2448;
SceneType = 1;
SensingMethod = 2;
ShutterSpeedValue = "6.908853996279415";
SubjectArea = (
1631,
1223,
1795,
1077
);
SubsecTimeDigitized = 927;
SubsecTimeOriginal = 927;
WhiteBalance = 0;
};
"{MakerApple}" = {
1 = 2;
14 = 0;
2 = <af001d01 9001ed01 9e011f01 70001500 41000d00 0a001000 12000900 0e000e00 b5003201 ae01f701 9b010401 5b001400 47002300 11001500 15000800 0d000d00 c2005501 eb014402 c901d900 67002400 3d002400 0f000b00 08000900 0d000d00 f1009201 30028e02 ff01b200 51000e00 43000e00 0d000e00 0d000d00 0c000b00 2d02b302 f802e902 26029700 80005600 5e000e00 0b000a00 09000900 0a000900 88039703 87033503 3c028300 44001100 45001100 0c000d00 0d000d00 0d000a00 b903b103 97034703 44027700 3e001000 38001000 0d000d00 0e000d00 0d000a00 a4039f03 87031503 22026d00 38000b00 34001000 0d001000 12000b00 0b000900 7b036a03 1d039c02 e2016400 37000e00 32001100 0d000a00 0a000600 07000700 c0029a02 4e02fb01 79015b00 36000e00 31001200 0c000900 0a000700 0c000b00 8b017801 4b013501 01015500 34000a00 30000900 06000c00 0e000800 14001000 b9001a00 34008a00 bd005000 2f000c00 2f000c00 0c000b00 0d000500 07000700 60000e00 0c002400 8f004b00 2f000a00 2d000f00 0e000700 07000700 0b000a00 47000b00 0a000b00 3d003300 28000a00 2b000a00 06000a00 0e000700 12001000 29000a00 09000a00 25003b00 2a000e00 2a000c00 0b000e00 11000700 0a000c00 27000a00 08000a00 0f003f00 3f001b00 31000d00 0e000700 07000700 0a000800>;
3 = {
epoch = 0;
flags = 1;
timescale = 1000000000;
value = 401611073225666;
};
4 = 1;
5 = 128;
6 = 119;
7 = 1;
8 = (
"0.01929908",
"-0.713904",
"-0.7083461"
);
};
"{TIFF}" = {
DateTime = "2015:07:08 14:24:15";
Make = Apple;
Model = "iPhone 6";
Software = "8.3";
XResolution = 72;
YResolution = 72;
};
As you see there is no location information. Well I tried to save image on local after get the location informatin but didnt work.
As I understand, If I can get path of the image which saved to the photo album, I can got
var path = args.Info[UIImagePickerController.ReferenceUrl].ToString();
refeenceURL like above and after I can get the location.. But i dont know how to get path of the newly saved image.
P.S.: I used Xamarin.iOS with C# but doesnt matter if you provide objective C or swift code.
I have an old snippet that I've never used (its an NSMutableDictionary category), because in the app I've used AVFoundation, but it worth a try. Credits to the creator of that code Gustavo Ambrozio.
Since is really old you should adapt for ARC compatibility.
- (id)initWithInfoFromImagePicker:(NSDictionary *)info {
if ((self = [self init])) {
// Key UIImagePickerControllerReferenceURL only exists in iOS 4.1
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 4.1f) {
NSURL* assetURL = nil;
if ((assetURL = [info objectForKey:UIImagePickerControllerReferenceURL])) {
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
[library assetForURL:assetURL
resultBlock:^(ALAsset *asset) {
NSDictionary *metadata = asset.defaultRepresentation.metadata;
[self addEntriesFromDictionary:metadata];
}
failureBlock:^(NSError *error) {
}];
[library autorelease];
}
else {
NSDictionary *metadata = [info objectForKey:UIImagePickerControllerMediaMetadata];
if (metadata)
[self addEntriesFromDictionary:metadata];
}
}
}
return self;
}
ALAssetRepresentation not listing the metadata details properly i,e when I try to get an image metadata, it returns only few details as below
2015-06-25 10:15:22.134 Phokl copy[1394:607] {
ColorModel = RGB;
DPIHeight = 72;
DPIWidth = 72;
Depth = 8;
Orientation = 1;
PixelHeight = 1250;
PixelWidth = 834;
"{Exif}" = {
ColorSpace = 1;
ComponentsConfiguration = (
1,
2,
3,
0
);
ExifVersion = (
2,
2,
1
);
FlashPixVersion = (
1,
0
);
PixelXDimension = 834;
PixelYDimension = 1250;
SceneCaptureType = 0;
};
"{TIFF}" = {
Orientation = 1;
ResolutionUnit = 2;
XResolution = 72;
YResolution = 72;
};
But when I check with other iOS apps and online exif data extractor, I can see more details about the same image and what I want from that is ISOSpeedRatings, FocalLength, LensModel, etc.
Why I'm not getting those details with asset.defaultRepresentation.metadata? Anybody has any clue on this?
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
[library assetForURL:info[UIImagePickerControllerReferenceURL] resultBlock:^(ALAsset *asset) {
// get imagePropertiesDictionary
NSDictionary *imagePropertiesDictionary;
imagePropertiesDictionary = asset.defaultRepresentation.metadata;
// get exif data
NSLog(#"%#",imagePropertiesDictionary);
Is there any alternate approach available in iOS ?
Update
I think, I found the issue. Actually, I tried with UIImagePickerController delegate where I didn't get the metadata. But, I tried with the copy of same image directly downloaded from server, now asset.defaultRepresentation.metadata returns the actual metadata. So here the problem is really with the image choosen from the Photo Library using UIImagePickerController where the exif data's were lost.
is this UIImagePickerController's default behavior?
I'm attempting to read the metadata produced by a UIImage when shot from the UIImagePicker, and I'm having some trouble.
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
image = [info objectForKey:#"UIImagePickerControllerOriginalImage"];
// get the metadata
NSDictionary *imageMetadata = [info objectForKey:UIImagePickerControllerMediaMetadata];
NSLog (#"imageMetaData %#",imageMetadata);
This successfully prints the metadata dictionary to NSLog.
The issue I'm having is that I would like to access specific indices of the dictionary (such as FNumber, ISO, etc.) and print them to specific labels, but I can't figure out how to access the individual data.
Here is what I have tried so far to pull the data, but it doesn't seem to find the key (it returns as NULL):
NSLog(#"ISO: %#", imageMetadata[#"ISOSpeedRatings"]);
Based off of what NSLog prints for the dictionary, it seems as if there may be dictionaries within the dictionary, and that's what's throwing me off.
Here's what gets printed for the metadata:
imageMetaData {
DPIHeight = 72;
DPIWidth = 72;
Orientation = 6;
"{Exif}" = {
ApertureValue = "2.27500704749987";
BrightnessValue = "-0.6309286396300304";
ColorSpace = 1;
DateTimeDigitized = "2015:04:01 10:33:37";
DateTimeOriginal = "2015:04:01 10:33:37";
ExposureBiasValue = 0;
ExposureMode = 0;
ExposureProgram = 2;
ExposureTime = "0.06666666666666667";
FNumber = "2.2";
Flash = 24;
FocalLenIn35mmFilm = 29;
FocalLength = "4.15";
ISOSpeedRatings = (
320
);
LensMake = Apple;
LensModel = "iPhone 6 back camera 4.15mm f/2.2";
LensSpecification = (
"4.15",
"4.15",
"2.2",
"2.2"
);
MeteringMode = 5;
PixelXDimension = 3264;
PixelYDimension = 2448;
SceneType = 1;
SensingMethod = 2;
ShutterSpeedValue = "3.907056515078773";
SubjectArea = (
1631,
1223,
1795,
1077
);
SubsecTimeDigitized = 705;
SubsecTimeOriginal = 705;
WhiteBalance = 0;
};
"{MakerApple}" = {
1 = 2;
14 = 0;
2 = <0f000b00 06000900 04005000 a900b100 b700bb00 c400cd00 cd00a400 b100c700 14000b00 05000900 06000a00 8a00a800 b000b800 c300cb00 c900cd00 b300a600 2f000700 06000700 0a000400 3500a400 ab00b300 bc00c300 cf00d300 b4007f00 3f000700 09000700 0a000700 05007100 a100af00 b500c200 ce00cd00 a9006b00 1f000a00 0b000900 0a000c00 05001e00 9c00aa00 b400c200 cc00d000 d4005700 2b001900 0d001000 10000d00 08000600 5b00a700 b300bf00 cb00d500 e3008600 eb002800 1a001700 14000c00 0b000700 10009400 b100c000 ce00e000 f400bd00 cf013e00 2a001200 17000f00 0d000800 07004200 b100c000 d300e900 fd000401 ff011101 1d000700 16001400 09000700 07000900 8900bf00 d800ec00 07011f01 10021102 39000b00 10001900 0e000800 0a000700 2c00bf00 dd00f400 0b012401 1e023802 1f010d00 07001900 16000c00 0c000800 21007000 c500f400 0a012e01 10022202 01022500 08001000 18001100 0d001800 1601cc00 d100eb00 09012201 fb011002 26020401 0f000700 16001400 3200e801 6001b000 ce00f400 08011601 e1010602 1a020302 23001700 21002300 84009300 9f00ad00 bf00e800 02011401 ca01fc01 19024002 08013d00 3500ca00 7c009200 9e00ab00 c200d700 f8000a01 b401f101 1b024802 28023000 4a007f00 7f008e00 a000b100 bd00d000 ec00fe00>;
3 = {
epoch = 0;
flags = 1;
timescale = 1000000000;
value = 777291330499583;
};
4 = 1;
5 = 128;
6 = 123;
7 = 1;
8 = (
"0.2226092",
"-0.5721548",
"-0.7796207"
);
9 = 275;
};
"{TIFF}" = {
DateTime = "2015:04:01 10:33:37";
Make = Apple;
Model = "iPhone 6";
Software = "8.1.2";
XResolution = 72;
YResolution = 72;
};
}
Is the data I'm looking for within another NSDictionary named Exif? And if so, how do I access it?
#david strauss can you try this once
- (void) saveImage:(UIImage *)imageToSave withInfo:(NSDictionary *)info{
// Get the assets library
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
// Get the image metadata (EXIF & TIFF)
NSMutableDictionary * imageMetadata = [[info objectForKey:UIImagePickerControllerMediaMetadata] mutableCopy];
// add GPS data
CLLocation * loc = <•••>; // need a location here
if ( loc ) {
[imageMetadata setObject:[self gpsDictionaryForLocation:loc] forKey:(NSString*)kCGImagePropertyGPSDictionary];
}
ALAssetsLibraryWriteImageCompletionBlock imageWriteCompletionBlock =
^(NSURL *newURL, NSError *error) {
if (error) {
NSLog( #"Error writing image with metadata to Photo Library: %#", error );
} else {
NSLog( #"Wrote image %# with metadata %# to Photo Library",newURL,imageMetadata);
}
};
// Save the new image to the Camera Roll
[library writeImageToSavedPhotosAlbum:[imageToSave CGImage]
metadata:imageMetadata
completionBlock:imageWriteCompletionBlock];
[imageMetadata release];
[library release];
}
The metadata dictionary as you've noticed consists of several dictionaries.
So to answer your question - yes, if you're looking for specific values you can access the inner dictionaries. Also, you'd better use the proper keys from ImageIO constants; for example:
NSLog(#"%#", imageMetadata[(NSString*)kCGImagePropertyExifDictionary][(NSString*)kCGImagePropertyExifISOSpeedRatings]);
Or, you can use a key-path:
NSString *keyPath = [NSString stringWithFormat:#"%#.%#",
(NSString*)kCGImagePropertyExifDictionary, (NSString*)kCGImagePropertyExifISOSpeedRatings];
NSLog(#"%#", [imageMetadata valueForKeyPath:keyPath]);
your all required data is within this dictionary only.
you can use json formatter to see the exact location of your data.
NSError *error;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject: imageMetadata
options:NSJSONWritingPrettyPrinted // Pass 0 if you don't care about the readability of the generated string
error:&error];
if (! jsonData) {
NSLog(#"Got an error: %#", error);
} else {
NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
NSLog(#"jsonString: %#", jsonString);
}
after this get the exact location of your data from json
I am new to ImageMagick,and i want to develop an effect of ShepardsDistortion on source image. i gone through many posts and sites, but i didn't find way to implement "ShepardsDistortion" in iOS.
MagickWand *mw = NewMagickWand();
MagickSetFormat(mw, "png");
UIImage *sourceImage=[_sourceImgView image];
NSData *imgData=UIImagePNGRepresentation(sourceImage);
MagickReadImageBlob(mw, [imgData bytes], [imgData length]);
Image *image=GetImageFromMagickWand(mw);
DistortImage(image, ShepardsDistortion, , ,);
I done upto this, but i dont know what to pass as arg in DitortImage(). So if anyone knows then help me.
EDIT:
-(void)distortImage{
MagickWandGenesis();
MagickWand * wand;
MagickBooleanType status;
wand = NewMagickWand();
MagickSetFormat(wand, "png");
status = MagickReadImage(wand,"chess.png");
// Arguments for Shepards
double points[8];
points[0] = 250; // First X point (starting)
points[1] = 250; // First Y point (starting)
points[2] = 50; // First X point (ending)
points[3] = 150; // First Y point (ending)
points[4] = 500; // Second X point (starting)
points[5] = 380; // Second Y point (starting)
points[6] = 600; // Second X point (ending)
points[7] = 460; // Second Y point (ending)
MagickDistortImage(wand,ShepardsDistortion,8,points,MagickFalse);
NSString * tempFilePath = [NSTemporaryDirectory() stringByAppendingPathComponent:#"out.png"];
MagickWriteImage(wand,[tempFilePath cStringUsingEncoding:NSASCIIStringEncoding]);
UIImage * imgObj = [UIImage imageWithContentsOfFile:tempFilePath];
_resultImgView.image=imgObj;
//
// unsigned char * cBlob;
// size_t data_size;
// cBlob = MagickGetImageBlob(wand, &data_size);
// NSData * nsBlob = [NSData dataWithBytes:cBlob length:data_size];
// UIImage *uiImage = [UIImage imageWithData:nsBlob];
// _resultImgView.image=uiImage;
MagickWriteImage(wand,"out.png");
wand=DestroyMagickWand(wand);
MagickWandTerminus();
}
This might help:
MagickWandGenesis();
magick_wand = NewMagickWand();
double points[24];
points[0] = 250;
points[1] = 250;
points[2] = 50;
points[3] = 150;
points[4] = 0;
points[5] = 0;
points[6] = 0;
points[7] = 0;
points[8] = self.frame.width;
points[9] = 0;
points[10] = self.frame.width;
points[11] = 0;
points[12] = self.frame.width;
points[13] = self.frame.height;
points[14] = self.frame.width;
points[15] = self.frame.height;
points[16] = self.frame.width;
points[17] = self.frame.height;
points[18] = self.frame.width;
points[19] = self.frame.height;
points[20] = 0;
points[21] = self.frame.height;
points[22] = 0;
points[23] = self.frame.height;
NSData * dataObject = UIImagePNGRepresentation([UIImage imageNamed:#"Imagemagick-logo.png"]);//UIImageJPEGRepresentation([imageViewButton imageForState:UIControlStateNormal], 90);
MagickBooleanType status;
status = MagickReadImageBlob(magick_wand, [dataObject bytes], [dataObject length]);
if (status == MagickFalse) {
ThrowWandException(magick_wand);
}
// posterize the image, this filter uses a configuration file, that means that everything in IM should be working great
status = MagickDistortImage(magick_wand,ShepardsDistortion,24,points,MagickFalse);
//status = MagickOrderedPosterizeImage(magick_wand, "h8x8o");
if (status == MagickFalse) {
ThrowWandException(magick_wand);
}
size_t my_size;
unsigned char * my_image = MagickGetImageBlob(magick_wand, &my_size);
NSData * data = [[NSData alloc] initWithBytes:my_image length:my_size];
free(my_image);
magick_wand = DestroyMagickWand(magick_wand);
MagickWandTerminus();
UIImage * image = [[UIImage alloc] initWithData:data];
[data release];
[imageViewButton setImage:image forState:UIControlStateNormal];
[image release];
Arguments are passed to DistortImage as the start of a list of doubles, and size information about the list. Example:
size_t SizeOfPoints = 8;
double Points[SizeOfPoints];
DistortImage(image,
ShepardsDistoration,
SizeOfPoints,
Points,
MagickFalse,
NULL
);
In your example, you seem to be mixing MagickWand & MagickCore methods; which, seems unnecessary and confusing. I would keep this distortion simple, and only use MagickWand's MagickDistortImage method. Here's a example in c
int main(int argc. const char **argv)
{
MagickWandGenesis();
MagickWand * wand;
MagickBooleanType status;
wand = NewMagickWand();
status = MagickReadImage(wand,"logo:");
// Arguments for Shepards
double points[8];
// 250x250 -> 50x150
points[0] = 250; // First X point (starting)
points[1] = 250; // First Y point (starting)
points[2] = 50; // First X point (ending)
points[3] = 150; // First Y point (ending)
// 500x380 -> 600x460
points[4] = 500; // Second X point (starting)
points[5] = 380; // Second Y point (starting)
points[6] = 600; // Second X point (ending)
points[7] = 460; // Second Y point (ending)
MagickDistortImage(wand,ShepardsDistortion,8,points,MagickFalse);
MagickWriteImage(wand,"out.png");
wand=DestroyMagickWand(wand);
MagickWandTerminus();
return 0;
}
Resulting in a distorted translated image (details)
Edit
For iOS, you can use NSTemporaryDirectory (like in this answer), or create an image dynamically using NSData (like in this question).
Example with temporary path:
NSString * tempFilePath = [NSTemporaryDirectory()
stringByAppendingPathComponent:#"out.png"];
MagickWriteImage(self.wand,
[tempFilePath cStringUsingEncoding:NSASCIIStringEncoding]);
UIImage * imgObj = [UIImage imageWithContentsOfFile:tempFilePath];
And an example with NSData + blob
unsigned char * cBlob;
size_t data_size;
cBlob = MagickGetImageBlob(wand, &data_size);
NSData * nsBlob = [NSData dataWithBytes:cBlob length:data_size];
UIImage * uiImage = [UIImage imageWithData:nsBlob];
How to get path on device of captured image ?
I am showing image and below I have switch when is off I show default image from project, when is on I want to show image which user captured.
In capture function I can set image to my imageView
#pragma mark - UIImagePickerControllerDelegate
- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info
{
[self dismissViewControllerAnimated:YES completion:NULL];
NSLog(#"%#", info);
UIImage * imageTemp = [info objectForKey:UIImagePickerControllerEditedImage];
if (imageTemp == nil)
imageTemp = [info objectForKey:UIImagePickerControllerOriginalImage];
[self.image setImage:imageTemp];
}
and it sets image to imageview but I don't have path. I have print info and it looks like
{
UIImagePickerControllerMediaMetadata = {
DPIHeight = 72;
DPIWidth = 72;
Orientation = 6;
"{Exif}" = {
ApertureValue = "2.526068811667588";
BrightnessValue = "5.667090406070278";
ColorSpace = 1;
DateTimeDigitized = "2013:05:14 01:02:48";
DateTimeOriginal = "2013:05:14 01:02:48";
ExposureMode = 0;
ExposureProgram = 2;
ExposureTime = "0.008620689655172414";
FNumber = "2.4";
Flash = 25;
FocalLenIn35mmFilm = 35;
FocalLength = "4.28";
ISOSpeedRatings = (
50
);
MeteringMode = 5;
PixelXDimension = 3264;
PixelYDimension = 2448;
SceneType = 1;
SensingMethod = 2;
ShutterSpeedValue = "6.862622389675391";
SubjectArea = (
1631,
1223,
881,
881
);
WhiteBalance = 0;
};
"{TIFF}" = {
DateTime = "2013:05:14 01:02:48";
Make = Apple;
Model = "iPhone 4S";
Software = "6.1.3";
XResolution = 72;
YResolution = 72;
};
};
UIImagePickerControllerMediaType = "public.image";
UIImagePickerControllerOriginalImage = "<UIImage: 0x20ac0470>";
}
but I cannot find anything what I can use to find path. How to find path o image so I can reload later again same image ?
If you want to use this image later stages in your app then you will have to save the URL of the image.
If you want to extract the image URL and Image name you can do it in your current implemented delegate method it self. The NSDictionary info contains all the information about the image.
#pragma mark - UIImagePickerControllerDelegate
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
NSURL *imagePath = [info objectForKey:#"UIImagePickerControllerReferenceURL"];
NSString *imageName = [imagePath lastPathComponent];
}
You can save image using imagePath at this stage inside didFinishPickingMediaWithInfo:
I think you can't find path to captured image because iPhone don't save it to file if you capture image your from code.
In my opinion, you have 2 ways:
1) You can create a singleton class for remembering UIImage in variable, and than have access to it.
2) You can save captured image to file in cache folder and then get path to it;