Thumbnail Generator

Problem description

“I have a big collection of photographs, and would like to search them. I have written a up keywords for each photograph in text files, e.g. ‘flower’, ‘beach’, ‘mountain’* etc. Now I need a program that can find all photographs for a given keyword.

The program should create a big picture that shows thumbnail images 100 pixels wide, like in the image below.”*

Rick Closeview , hobby photographer

Thumbnail matrix

Instructions

Implement a program according to the problem description. The following steps may be helpful:

1. Planning

Dissect the problem into at least three separate sub-problems. Write them down on paper (cards or a single sheet). Try to be as precise as possible. Answer resulting questions.

2. Divide the program into functions

Identify key functions your program needs to have. Decide what should be the input and output for each of them. Write them up as well.

3. Get the Graphics

The file sample_photos.zip contains a few example photographs. It also contains a file pics.txt in each subfolder. This is the input information for the program.

4. Explore Python libraries

You might want to take a closer look at:

  • os for file handling
  • Pillow for image manipulation

5. Write the program

After these steps, start implementing.