I have an image with a-lot of exif informations. But when trying to read the exif information with swift, it shows limited number of exif information.
I have tried following code:
let data = UIImageJPEGRepresentation(image, 1.0)
let source = CGImageSourceCreateWithData(data! as CFData, nil)
let metadata = (CGImageSourceCopyPropertiesAtIndex(source!, 0, nil))
debugPrint(metadata ?? "nil")
And it prints the following result:
{
ColorModel = RGB;
Depth = 8;
Orientation = 6;
PixelHeight = 2448;
PixelWidth = 3264;
ProfileName = "sRGB IEC61966-2.1";
"{Exif}" = {
ColorSpace = 1;
PixelXDimension = 3264;
PixelYDimension = 2448;
};
"{JFIF}" = {
DensityUnit = 0;
JFIFVersion = (
1,
0,
1
);
XDensity = 72;
YDensity = 72;
};
"{TIFF}" = {
Orientation = 6;
};
}
How can I read all the exif information from UIImage?
UIImagePickerController
camera andUIImagePickerControllerMediaMetadata
to see all the EXIF data and saved the image. But then I used your code (which is what I'd do also) on said image and found thatCGImageSourceCopyPropertiesAtIndex
only had what you found - an incomplete dictionary of data. – Dustpan