I had a bunch of mobile screenshots that needed to be sent as a document for printing. I wanted to stitch every 6 screenshots together into a single A4-size image so I could send them over WhatsApp. That way I would end up with only 4 or 5 images – much easier to share, and the other person could print them directly.
At first, I tried putting them together in Snagit, which I already had installed. But resizing each screenshot manually was quite cumbersome. So I asked Gemini AI for suggestions. I typed: “I have 34 phone screenshots and I want to paste 6 screenshots per A4 size pic. How to do that? I want two rows and three columns per page so I can create A4 images and take a print.”
Gemini suggested using a landscape orientation instead of portrait, since phone screenshots are tall and narrow. It gave me three options:
1. Using Microsoft Word: Open a blank page, change the orientation to landscape, insert a 3×2 table, and drag-and-drop the images into the cells.
2. A no-software method using File Explorer: Select six pictures, right-click, choose Print, and pick the 6-images layout.
3. Using online tools: Upload the pictures to a website that lets you arrange them and download as PDF or image.
I started with the first method, which I’ve used many times before. I opened Word, inserted a table, and began dragging images one by one into the cells. It took a significant amount of time because every image had to be resized individually. The final result was okay, but not perfect.
Then I remembered something. Earlier, I had worked on a client project where I needed to programmatically resize images, add a website name and logo, and convert them into a specific format. I had used Python for that. With just a few lines of code, Python can do some pretty amazing things.
That gave me an idea. I asked Gemini: “Can I do this with Python code or something to automate it?” Gemini replied that yes, I could fully automate the whole process using Python and the Pillow library. It even generated a simple script for me. I copied the code, pasted it into Notepad, and saved it as “pic.py.” I also asked for a version that creates PDFs and saved that as “picpdf.py.”
The image-creation code is just about 104 lines and the PDF version is even shorter, just 69 lines. Now, open the command line by typing “CMD” in the address bar of File Explorer. Typing “DIR” shows the list of files.
If you haven’t installed Python yet, enter this command in command line window: winget install -e --id Python.Python.3
Then install the Pillow library with: pip install Pillow
Now type “py pic.py” and hit Enter. It will create the images. Three pictures in each row, six pictures neatly arranged on a single page. And, it processed everything very quickly. Next, let’s check the PDF version. Type “py picpdf.py” and press Enter. In just a few seconds, a single PDF is created with 4 pages and 6 images on each page, perfectly laid out.