Date information is not available in image exif data

314 views Asked by At

After picking image from gallery, date information is not available in image exif data. But when I checked the exif data of the same image using an online tool, its there. Can anybody tell me a solution to get date info from exif data. I tried the following code, but its not printing the date info. I tried with different types of images.

    let data = UIImageJPEGRepresentation(image, 0.5)
    let source = CGImageSourceCreateWithData(data as! CFData, nil)
    let metadata = CGImageSourceCopyPropertiesAtIndex(source!, 0, nil) as! NSDictionary
    print(metadata )

Output of the above code is

    {
        ColorModel = RGB;
        Depth = 8;
        Orientation = 1;
        PixelHeight = 2448;
        PixelWidth = 2448;
        ProfileName = "sRGB IEC61966-2.1";
        "{Exif}" =     {
            ColorSpace = 1;
            PixelXDimension = 2448;
            PixelYDimension = 2448;
        };
        "{JFIF}" =     {
            DensityUnit = 0;
            JFIFVersion =         (
                1,
                0,
                1
            );
            XDensity = 72;
            YDensity = 72;
        };
        "{TIFF}" =     {
            Orientation = 1;
        };
    }
0

There are 0 answers