Swift image i/o missing metaData

Viewed 168

I am using image I/O. I want take all metaData include kCGImagePropertyExifDateTimeDigitized and others.

But I get very little information:

ColorModel = RGB;
Depth = 8;
Orientation = 6;
PixelHeight = 3024;
PixelWidth = 4032;
ProfileName = "Display P3";
"{Exif}" =     {
    ColorSpace = 65535;
    PixelXDimension = 4032;
    PixelYDimension = 3024;
};
"{JFIF}" =     {
    DensityUnit = 0;
    JFIFVersion =         (
        1,
        0,
        1
    );
    XDensity = 72;
    YDensity = 72;
};
"{TIFF}" =     {
    Orientation = 6;
};

Where is original date and time, digitized date and time or GPS cordination. Because my image have this metaData.

My SWIFT code:

let TEST_IMAGE: String = "IMG_6489.JPG"
let beach: UIImage = UIImage(named: TEST_IMAGE)!
let imageData: Data = beach.jpegData(compressionQuality: 1)!

let cgImgSource: CGImageSource = CGImageSourceCreateWithData(imageData as CFData, nil)!
let uti: CFString = CGImageSourceGetType(cgImgSource)!
let dataWithEXIF: NSMutableData = NSMutableData(data: imageData)
let destination: CGImageDestination = CGImageDestinationCreateWithData((dataWithEXIF as 
CFMutableData), uti, 1, nil)!

let imageProperties = CGImageSourceCopyPropertiesAtIndex(cgImgSource, 0, nil)! as 
NSDictionary
let mutable: NSMutableDictionary = imageProperties.mutableCopy() as! NSMutableDictionary

print(mutable)
print(mutable[kCGImagePropertyExifDateTimeOriginal])
0 Answers
Related