Table of Contents       17 NeoFinder and Photos


17.5 Truncate JPG files

There is a very unfortunate bug in macOS and/or iOS, which can cause a lot of empty NULL data to be appended to JPG files transferred over from iPhones or iPads, if these iOS devices are using the HEIC format internally. If you only use JPG on your iOS devices, this doesn't seem to happen.

https://cdfinder.de/blog/files/image_capture_bug.html

This bug can happen for any iOS file transferred to the Mac, using Adobe Lightroom, Apples old iPhoto and Aperture, Affinity Photo, or any other Mac applications, even including the discontinued old PhaseOne MediaPro.

The JPG files imported by macOS can contain more than 1,5 MB of empty data appended to the end of the file, increasing the file size massively, wasting space on your disks. These JPG files are much larger in size than they actually need to be.

On my development machine, I have found more than 12.000 such JPG files, wasting a total of almost 20 GB of additional data in them!

NeoFinder can now reclaim that wasted space for you.


Here is how to do that:

1. You definitely have made a complete backup of your photos, right? If not, do it right now.

2.
Catalog your JPG photos with NeoFinder. To speed things up, create either no thumbnails at all, or just small ones.

3. In NeoFinder, select the JPG files you wish to truncate, and use the contextual menu, and the new
Truncate JPG files option there:

truncate cmm


NeoFinder will then ask you for the options and a confirmation:

truncate GUI

You have the option to keep the original modification date of all files, if you don't wish to have them backed up again.

Use the
Truncate button and NeoFinder will show you a progress while is works through the selected files, checks for unwanted empty data at the end of the JPG files, and removes it for you.

When NeoFinder is done, you will see a message telling you how much space NeoFinder has reclaimed for you:

trucate success

If all selected JPG files were fine and had no additional empty data attached to them, NeoFinder will tell you as well:

truncate nothing needed

We hope that Apple will soon fix this bug in its ImageCaptureCore.framework and this won't be needed for any newly transferred photos any more.



Notes

This code will only check files whose name ends with .JPG or .JPEG. Other file types are ignored.

This also requires that you have write access to the photos file you wish to truncate, or NeoFinder cannot change the file size for you.



Next

17.1 Photo Contact Sheet
17.2 Adobe XMP, EXIF and IPTC meta data
17.3 Lossless picture rotation
17.4 Edit the EXIF creation date
17.5 Truncate JPG files
17.6 Photographer Workflows
17.7 Photo Export
17.8 Astronomy data
17.9 Watermark Presets
17.10 QuickEdit
17.11 Unique Photo ID

5.8 Find Similar Photos