Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to avoid image duplication in image gallery of iOS device?

I want to store the images to photo gallary. But if images are already available at photo gallary then how to distinguish for whether imgaes are already exists or not? I didnt find property like unique identifier or should i compare by taking data in the form of NSdata?

thanks..

like image 472
Swapnil Avatar asked Feb 23 '12 07:02

Swapnil


People also ask

How do I get my iPhone to stop duplicating photos?

You can go to Settings > Camera > Toggle off the option Keep Normal Photo. After editing photos, it is suggested to delete original photos in time to avoid your iPhone saving too many similar photos.

Why are my iPhone pictures duplicating?

Duplicate images can happen due to syncing errors or syncing folders multiple times — or simply taking too many photos of the same thing. You can remove duplicates with third-party apps (we recommend Gemini Photos) or by doing it manually. Removing duplicates allows you to free up more storage on your iPhone.


1 Answers

You can maintain a dictionary of hashes for each the image in the photo gallery, and then show only additional images who do not hashes are not present in the dictionary

As a reminder, you can check for an object in a dictionary by doing:

if ([myDictionary objectForKey:variableStoringImageHash] == nil) {
   //No such image present
}
else {
   //image is present
}

For a bit about hashing an image, this might help: iPhone: fast hash function for storing web images (url) as files (hashed filenames)

like image 126
Eitan Avatar answered Oct 29 '22 15:10

Eitan