Distribution of file size for different formats #
The photos library of my phone, which consists of random shots taken in the years 2016 to 2020, is analyzed to compare the file sizes of images encoded in formats JPEG and HEIC.
- Burst images, which are near-duplicates, are removed.
- Large-sized stitched panoramic images and images not taken with the phone camera, including low-resolution WhatsApp images, are filtered out by ensuring the inclusion of "back camera" in the "EXIF LensModel" field and a resolution of 4032 × 3024 for each image.
Both of the histogram plots generated show a right-skewed distribution with the mean greater than the median. Since the ratio mean of file sizes with JPEG to that with HEIC is 1.4574 MB / 2.2827 MB = 0.6385, with JPEG as a baseline, HEIC offers an approximately 36% storage space saving on average.
The statistics could be informative to users of Apple devices on whether savings in storage space justify the loss of backwards compatibility with older software by switching from JPEG to HEIC as the compressed image format.
Limitation of analysis #
While this comparison of the two image formats has practical value as mentioned, it has limited theoretical value for the following factors not controlled.
The images in the two formats have completely different content since saving the same image captured in both JPEG and HEIC is not an available option in the software that generates the images.
The images vary in visual complexity. The compression parameters of each of the formats are non-configurable and unknown to users.
The dataset used consists of only a few thousand images. The HEIC dataset is much smaller than the JPEG dataset, which may explain the ragged shape in the histogram for the HEIC dataset although with a larger histogram bin size configured.
Note on image formats #
High Efficiency Image File Format (HEIF) with a rich set of features was adopted in Apple software in 2017 with
.HEIC as the file extension for single images. Previously, images captured by an Apple device are stored in the popular JPEG format with file extension
iOS camera capture format settings
It is suggested that a similar analysis of file size can be performed on other new compressed image formats, such as the AVIF format.
Distribution of creation time #
The following histogram of the frequency of hours extracted from the "EXIF DateTimeOriginal" field of images shows a curious approximation of a normal distribution. It indirectly represents the frequency of my physical activities in different times of a day.
A curve with a similar shape and frequency peak value has been observed in a plot of the frequency of hours extracted from my other activity logs that span a long enough period, such as pedometer logs and internet search history.
- Feb 2021 Added bar plot of frequency of hour of day in image timestamps.
- Oct 2020 Re-organized content in bullet points.