Get Photo Data from Google Drive!
Nowadays, taking photos with a mobile phone has been a common thing for people. In addition, more and more people also adopt the habit of storing these photos on the cloud. The tool I use most is Google Drive. It’s a useful tool that we can upload any photo anywhere whenever we get the Internet. However, it’s also getting hard to find the specific photos we’ve taken before once the amount of it is getting larger. In order to resolve this pain point, I’m thinking if it might be good if we could get the photo tag information and then store them in the form of the text, then it would be easier for us to search and filter the photo we want.
Therefore, I laid out a data manipulation flow chart for this task. Basically, exifread would be the package I use to get the photo tag data, like coordinate, the tool used to take the photo, the spec of the tool, orientation of the photo, time the photo is taken, and the photo file format. Besides, the file path would also be recorded during the whole process, because we also plan to use some TensorFlow’s Keras API to analyze the photo in the future.
The IDE I used to get this task done is Colab. So, firstly we need to import some packages as the following image for our codes.
The next step is to rename the file as there could be file name duplication. As a result, we need to add a number with the bottom line at the start of every file name.
And then, we have to handle the file search, coordinate unit transformation and the DateTime format adjustment as the following code. Firstly, we need to create the function used to transform the coordinate into the format we’re more familiar with.
Next, we need to search the whole files in the same parent directory.
Last but not least is to give the value to those without DateTime data and convert the DateTime format to the proper one.
After that, we would get the result as the following data frame. From this file, we would get the photo information and also the photo link for us to check. Afterward, in the next article, I would also include the Mobile Net, which is the TensorFlow package, and the GeoCoding function inside to further help us know what the photo is before we check it.
This article would help the readers to understand the use of the package of the Google Drive, the exifread package, and how to easily get the photo tag information. Hope you enjoy this article and may the next article would come soon.