Build a command line app that sorts your images by type

Have you ever wanted a simple way to sort all those photos you have on your hard-drive or in an old folder? Turns out there’s a way to do that and sort images based on their content.

What you need to begin

  1. A Sightengine API Keys. Sign up for free if you don’t have one.
  2. A dataset of images to sort. In this article I use random image from Pexels.
  3. Python installed on your computer.

Difference between illustration and photography

An illustration could be a drawing, a clipart, a painting, a logo or any such image that does not look like a photography.

Create the project

Our app will consist of only one file called

We traverse through all of the image files in the current directory and send them through the Sightengine API. Then we retrieve the output and check the probability which indicates the type of the image. Finally we move the image into the respective folder and print out a message to the terminal.

We’ve built a command line application using Python that will sort images by type. For next steps, you can swap the model we’re using to sort your images according to your needs.