A few years ago, I went for a vacation with my friends ... bla bla bla ... and all the pictures from everyone's phones somehow landed in a single folder on my machine. For some reason I wanted them separate(I don't know why, it was a long time ago) and then what happened is why you're here reading this post.
Tools:
- Python
- PIL library
- os library
Key functions:
- Use
os.listdir
to get the names of image files(requires split on.
and check extension) in the directory. - Function
getCameraModel
usesPIL.Image
and returns the camera model of image. - Function
copy
to copy that image file into the folder with name same as camera model (creates if doesn't exist).
Just put'em all together and you're good to go. Here's the gist.
Top comments (0)