I have a folder full of .heic files transferred from my iPhone. For compatibility with other software that cannot read HEIC format, I need to convert these files into JPG format. However, I’ve encountered a problem with the file conversion process. Every method I’ve tried so far for converting these HEIC files to JPG results in the creation of new JPG files with their timestamps.
These new timestamps do not match the original creation and modification times of the photos. This is problematic for me as I need the JPG files to retain the original timestamps of the HEIC files. Is there a way to convert these files while preserving the original timestamps?
Preserving timestamps during conversion can be tricky, but it’s possible. The key is to convert the HEIC files to JPG first and then manually transfer the original timestamps from the HEIC files to the new JPG files.
You can use a scripting language like Python to automate this process. Python’s os module can be used to read the timestamps from the original files and apply them to the converted files.
After converting your HEIC files to JPG, you can use a Python script like this:
from shutil import copy2
# Assuming 'converted_images' is your directory with converted JPGs
# and 'original_images' is the directory with original HEICs
for file in os.listdir('converted_images'):
original_file = os.path.join('original_images', file.replace('.jpg', '.heic'))
converted_file = os.path.join('converted_images', file)
# Copy timestamps from original to converted
copy2(original_file, converted_file, follow_symlinks=True)
This script will copy the timestamps from each HEIC file to the corresponding JPG file.
What if I’m not comfortable with scripting? Is there another way?
If scripting isn’t an option, you can use file management software that allows for manual editing of file timestamps. Some advanced file managers or photo management tools have this functionality, but it might require doing it for each file individually, which can be time-consuming for a large number of files.