Home > Back-end >  How can I search for all non-resource image (paths) on a drive?
How can I search for all non-resource image (paths) on a drive?

Time:07-26

I want to write a program that gathers all pictures that someone may have on their computer, while ignoring any resource files (i.e. a .jpg for a game icon, for a game in their Program Files, etc.)

What can I research/learn about for accomplishing this?

Is there some sort of meta-data that can be tied to user-generated pictures, etc?

I want to start with .jpg/.jpeg files at first, but eventually I'd like to include:

  • Any Camera files that were uploaded and saved to the computer.
  • Any picture that was downloaded from the internet and saved.
  • files from image creation/editing tools such as aseprite or photoshop and saved.

Any help is appreciated and any criticism is accepted. Thank you in advance for your direction.

Edit: For a use case example, I'd like to be able to search through a drive for pictures that a user has, that they may not remember where they saved them.

CodePudding user response:

There is no reliable way to know if a image is intended to be used as a resource. Programs can be stored anywhere on the drive, so using the path will not be reliable. And images from the internet may have arbitrary metadata.

My suggestion would be to find all images (note that this will take some time), and use some heuristic to guess what folders represent an image archive. Presumably most people would store photos in one or a few different folders. If all subfolders mostly contain image files, and no files like .exe or .dll files, it would be a good candidate. But you should probably ask the user to confirm the folder selection and allow for changes.

Note that things like cached internet images would probably not be included since they will be mixed in with other types of cached data.

  • Related