[ALUG] Intelligently deleting thumbnail images

steve-ALUG at hst.me.uk steve-ALUG at hst.me.uk
Thu Sep 7 11:04:27 BST 2017

On 07/09/17 10:43, Mark Rogers wrote:
> A friend lost all their photos from their phone; luckily they had been
> on a MicroSD card and photorec recovered them all for me, and renrot
> renamed them all (and fixed their timestamps) based on their EXIF
> data.
> So what I now have is a directory of images, but of-course the phone
> had created thumbnails and the recovery has recovered them as well,
> and I'd like to delete them.

Two obvious solutions.  List all files by file size (is there an option 
in ls, or use ls -al then sort?)
Delete files smaller than a certain size, or move files smaller than a 
certain size to a different directory and then delete ones that are not 
Alternatively, do the same graphically in a file manager, sort by size, 
pick a small size, then go through each and manually delete the thumbnails.

The other solution.  Use a tool to read the exif data of all files (is 
it exiftool?).  Work out the image sizes.  Work out what sizes your 
thumbnails are.  write a script to delete or move these files somewhere 
else where they can be manually pruned.
> As a human it's easy to do: find two images that "look" the same, and
> delete the smaller one. But there are hundreds so this human isn't up
> for the job.
> Any suggestions as to how to do this in software?
> Just deleting all the smaller images isn't enough as there do seem to
> be some small images for which there isn't a larger counterpart (I'm
> guessing maybe they came from the front facing camera or some other
> source).
Well, that's the problem isn't it.  You can either spend time 
programming a solution may work for most, or you can spend time manually 

Good luck.


More information about the main mailing list