iOS Photo Uploads

iOS device model used for testing: iPad Air 4th Generation iOS system version: 14.5 Safari: 14.1 Chrome: 90 For one of my projects I have to sort photos by the date and time the photos were taken. Ideally, down to the millisecond. Now this information is normally embedded into most camera photos. Read Wikipedia article about EXIF data.

However, when someone uploaded photos from iOS to a webpage, I noticed some issues. This blog post hopes to clarify the issues I found in case anyone else ever runs into this issue. I used both Chrome and Safari in iOS and had similar results.

First of all iOS has a camera setting for photos called High Efficiency. Sample file name from the iOS device: IMG_0952.HEIC

The second camera setting is called Most Compatible. Sample file name from the iOS device: IMG_0326.JPG

When uploading image files from iOS, the image is converted automatically into .jpeg format. But not only that but if uploading from a previously captured photo on iOS then the webpage will get a random UUID file name such as: BE3158EE-0ACD-442C-BFE7-FF1AA904D947.jpeg Read Wikipedia article about UUID.

If you upload an image from the iOS device directly from the camera (using the option Take Photo or Video), then the webpage will receive the filename: image.jpeg

When files are uploaded there are a few file properties available for reading via Javacript. Read about Web API File The one file property that I am most interested in is the lastModified date which returns the last modified time of the file, in millisecond since the UNIX epoch (January 1st, 1970 at Midnight).

If I upload an image from iOS that was taken with the camera format Most Compatible the lastModified date is correct.

If I upload an image from iOS that was taken with the camera format High Efficiency the lastModified date is correct but only to a relative degree.

To demonstrate the issue found I take one photo per second for 10 seconds in both camera formats then I can compare the lastModified date.

From my experiments, I found that what iOS does when uploading a High Efficiency photo to a webpage, is quickly convert it to JPEG. This causes the file to have a last modified file date of the time the photo is actually uploaded to the webpage. You can test this as well from here: https://codepen.io/warrenkc/full/MWpeMQd.

EXIF Data

Now what about the EXIF data? iOS strips the EXIF data from the photos taken in High Efficiency mode when uploading to a webpage. You can see the difference by comparing the data below:

High Efficiency EXIF Data

For example, if I upload IMG_0952.HEIC from iOS to a webpage this is the EXIF data that is embedded into the JPEG file (You will notice there is no data on when the file was created or last modified):

  • File Name: E21DB391-5D92-4B8B-9FC0-F99FC8E6A7B4.jpeg
  • File Size: 7.0 MiB
  • File Type: JPEG
  • File Type: Extension jpg
  • Mime Type: image/jpeg
  • Exif Byte Order: Big-endian (Motorola, MM)
  • Orientation: Horizontal (normal)
  • X Resolution: 72
  • Y Resolution: 72
  • Resolution Unit: inches
  • Y Cb Cr Positioning: Centered
  • Exif Version: 221
  • Components Configuration: Y, Cb, Cr, -
  • Flashpix Version: 100
  • Color Space: sRGB
  • Exif Image Width: 3024
  • Exif Image Height: 3024
  • Scene Capture Type: Standard
  • Compression: JPEG (old-style)
  • Thumbnail Offset: 298
  • Thumbnail Length: 8678
  • Profile Cmm Type: Apple Computer Inc.
  • Profile Version: 4.0.0
  • Profile Class: Display Device Profile
  • Color Space Data: RGB
  • Profile Connection Space: XYZ
  • Profile Date Time: 2017:07:07 13:22:32
  • Profile File Signature: acsp
  • Primary Platform: Apple Computer Inc.
  • Cmm Flags: Not Embedded, Independent
  • Device Manufacturer: Apple Computer Inc.
  • Device Attributes: Reflective, Glossy, Positive, Color
  • Rendering Intent: Perceptual
  • Connection Space Illuminant: 0.9642 1 0.82491
  • Profile Creator: Apple Computer Inc.
  • Profile Id: ca1a9582257f104d389913d5d1ea1582
  • Profile Description: Display P3
  • Profile Copyright: Copyright Apple Inc., 2017
  • Media White Point: 0.95045 1 1.08905
  • Red Matrix Column: 0.51512 0.2412 -0.00105
  • Green Matrix Column: 0.29198 0.69225 0.04189
  • Blue Matrix Column: 0.1571 0.06657 0.78407
  • Red Trc: (Binary data 32 bytes)
  • Chromatic Adaptation: 1.04788 0.02292 -0.0502 0.02959 0.99048 -0.01706 -0.00923 0.01508 0.75168
  • Blue Trc: (Binary data 32 bytes)
  • Green Trc: (Binary data 32 bytes)
  • Image Width: 3024
  • Image Height: 3024
  • Encoding Process: Baseline DCT, Huffman coding
  • Bits Per Sample: 8
  • Color Components: 3
  • Y Cb Cr Sub Sampling: YCbCr4:2:0 (2 2)
  • Image Size: 3024x3024
  • Megapixels: 9.1
  • Thumbnail Image: (Binary data 8678 bytes)
  • Category: image
  • Raw Header: FF D8 FF E1 23 0E 45 78 69 66 00 00 4D 4D 00 2A 00 00 00 08 00 06 01 12 00 03 00 00 00 01 00 01 00 00 01 1A 00 05 00 00 00 01 00 00 00 56 01 1B 00 05 00 00 00 01 00 00 00 5E 01 28 00 03 00 00 00 01 00 02 00 00 02 13 00 03 00 00 00 01 00 01 00 00 87 69 00 04 00 00 00 01 00 00 00 66 00 00 00 C0 00 00 00 48 00 00 00 01 00 00 00 48 00 00 00 01 00 07 90 00 00 07 00 00 00 04 30 32 32 31

Most Compatible EXIF Data

For example, if I upload IMG_0326.JPG from iOS to a webpage this is the EXIF data that is embedded into the JPEG file:

  • File Name: 0AD5C057-A1D4-4974-BFD7-C3A2BAA29A9A.jpeg
  • File Size: 4.9 MiB
  • File Type: JPEG
  • File Type Extension: jpg
  • Mime Type: image/jpeg
  • Exif Byte Order: Big-endian (Motorola, MM)
  • Make: Apple
  • Model: iPad Air (4th generation)
  • Orientation: Horizontal (normal)
  • X Resolution: 72
  • Y Resolution: 72
  • Resolution Unit: inches
  • Software: 14.5
  • Modify Date: 2021:05:19 18:21:22
  • Host Computer: iPad Air (4th generation)
  • Y Cb Cr Positioning: Centered
  • Exposure Time: 1/120
  • F Number: 1.8
  • Exposure Program Program: AE
  • Iso: 25
  • Exif Version: 232
  • Date Time Original: 2021:05:19 18:21:22
  • Create Date: 2021:05:19 18:21:22
  • Offset Time: +08:00
  • Offset Time Original: +08:00
  • Offset Time Digitized: +08:00
  • Components Configuration: Y, Cb, Cr, -
  • Shutter Speed Value: 1/120
  • Aperture Value: 1.8
  • Brightness Value: 6.20582502
  • Exposure Compensation: 0
  • Metering Mode: Multi-segment
  • Flash: No flash function
  • Focal Length: 3.0 mm
  • Subject Area: 1508 1511 2217 1330
  • Run Time Flags: Valid
  • Run Time Value: 15402082376875
  • Run Time Scale: 1000000000
  • Run Time Epoch: 0
  • Acceleration Vector: -0.9922823907 -0.01768151112 -0.09478691215
  • Sub Sec Time Original: 814
  • Sub Sec Time Digitized: 814
  • Flashpix Version: 100
  • Color Space: Uncalibrated
  • Exif Image Width: 3024
  • Exif Image Height: 3024
  • Sensing Method: One-chip color area
  • Scene Type: Directly photographed
  • Exposure Mode: Auto
  • White Balance: Auto
  • Focal Length In35Mm Format: 34 mm
  • Scene Capture Type: Standard
  • Lens Info: 3mm f/1.8
  • Lens Make: Apple
  • Lens Model: iPad Air (4th generation) back camera 3mm f/1.8
  • Composite Image: General Composite Image
  • Gps Latitude: Ref North
  • Gps Longitude: Ref East
  • Gps Altitude Ref: Above Sea Level
  • Gps Speed Ref: km/h
  • Gps Speed: 0
  • Gps Img Direction Ref: True North
  • Gps Img Direction: 255.5400697
  • Gps Dest Bearing: Ref True North
  • Gps Dest Bearing: 255.5400697
  • Gps Date Stamp: 2021:05:19
  • Gpsh Positioning Error: 65 m
  • Compression: JPEG (old-style)
  • Thumbnail Offset: 2480
  • Thumbnail Length: 8143
  • Profile Cmm: Type Apple Computer Inc.
  • Profile Version: 4.0.0
  • Profile Class: Display Device Profile
  • Color Space Data: RGB
  • Profile Connection Space: XYZ
  • Profile Date Time: 2017:07:07 13:22:32
  • Profile File Signature: acsp
  • Primary Platform: Apple Computer Inc.
  • Cmm Flags: Not Embedded, Independent
  • Device Manufacturer: Apple Computer Inc.
  • Device Attributes: Reflective, Glossy, Positive, Color
  • Rendering Intent: Perceptual
  • Connection Space Illuminant: 0.9642 1 0.82491
  • Profile Creator: Apple Computer Inc.
  • Profile Id: ca1a9582257f104d389913d5d1ea1582
  • Profile Description: Display P3
  • Profile Copyright: Copyright Apple Inc., 2017
  • Media White Point: 0.95045 1 1.08905
  • Red Matrix Column: 0.51512 0.2412 -0.00105
  • Green Matrix Column: 0.29198 0.69225 0.04189
  • Blue Matrix Column: 0.1571 0.06657 0.78407
  • Red Trc: (Binary data 32 bytes)
  • Chromatic Adaptation: 1.04788 0.02292 -0.0502 0.02959 0.99048 -0.01706 -0.00923 0.01508 0.75168
  • Blue Trc: (Binary data 32 bytes)
  • Green Trc: (Binary data 32 bytes)
  • Image Width: 3024
  • Image Height: 3024
  • Encoding Process: Baseline DCT, Huffman coding
  • Bits Per Sample: 8
  • Color Components: 3
  • Y Cb Cr Sub Sampling: YCbCr4:2:0 (2 2)
  • Run Time Since Power Up: 4:16:42
  • Aperture: 1.8
  • Image Size: 3024x3024
  • Lens Id: iPad Air (4th generation) back camera 3mm f/1.8
  • Megapixels: 9.1
  • Scale Factor35Efl: 11.3
  • Shutter Speed: 1/120
  • Sub Sec Create Date: 2021:05:19 18:21:22.814+08:00
  • Sub Sec Date Time Original: 2021:05:19 18:21:22.814+08:00
  • Sub Sec Modify Date: 2021:05:19 18:21:22+08:00
  • Thumbnail Image: (Binary data 8143 bytes)
  • Gps Altitude: 102.1 m Above Sea Level
  • Gps Latitude: 2 deg 59’ 17.30” N
  • Gps Longitude: 121 deg 18’ 5.47” E
  • Circle Of Confusion: 0.003 mm
  • Fov: 55.8 deg
  • Focal Length35Efl: 3.0 mm (35 mm equivalent: 34.0 mm)
  • Gps Position: 24 deg 59’ 17.30” N, 121 deg 18’ 52.47” E
  • Hyperfocal Distance: 1.89 m
  • Light Value: 10.6
  • Category: image
  • Raw Header: FF D8 FF E1 29 7D 45 78 69 66 00 00 4D 4D 00 2A 00 00 00 08 00 0C 01 0F 00 02 00 00 00 06 00 00 00 9E 01 10 00 02 00 00 00 1A 00 00 00 A4 01 12 00 03 00 00 00 01 00 01 00 00 01 1A 00 05 00 00 00 01 00 00 00 BE 01 1B 00 05 00 00 00 01 00 00 00 C6 01 28 00 03 00 00 00 01 00 02 00 00 01 31 00 02 00 00 00 05 00 00 00 CE 01 32 00 02 00 00 00 14 00 00 00 D4 01 3C 00 02 00 00 00 1A 00 00

Conclusion

If you need photos to be uploaded to a webpage from an iOS device and to be sorted by date and time, you need to use the camera format: Most Compatible. There doesn’t seem to be a way to sort photos by date that are uploaded from the High Efficiency format.

Camera settings images:

iOS Camera Settings iOS Camera Settings