AI Technology News

Your Daily Dose of AI Innovation & Insights

Using Generative AI to Create a Picture with Three Bridges | by Filip Van Laenen | Compendium | Apr, 2025

Using Generative AI to Create a Picture with Three Bridges | by Filip Van Laenen | Compendium | Apr, 2025

Put Ads For Free On FiverrClerks.com

When I write a blog article, I like to add an illustration to it. Ideally, the illustration visually represents the concept or the pattern that I’m writing about. In other cases, it’s just a picture with an association to the article’s topic, to make it more lively. Finding a suitable image is sometimes straightforward, like for the articles about collections. But for my last article, about the three toArray methods, finding a picture that made even the slightest sense, proved very challenging.

As the three toArray methods act as bridge methods between Java collections and arrays, I got the idea to use a picture featuring three bridges. My first step was to look on Flickr to see whether I could find a nice picture with three bridges in it, and with a license that would permit me to use it as an illustration for a blog article. There aren’t that many places in the world where you have three bridges close to each other, with the obvious exception of large cities along a river, like Paris or London. I didn’t have a picture from a city in my mind though, but rather a more generic picture of three bridges in a river landscape. I could find a number of pictures that fitted these requirements, but none of the good ones had the right type of license.

Five years ago, that’s where this story would have ended. Luckily, generative AI is now able to generate realistic pictures from a simple sentence, and I decided to give it a try. I used Google Gemini, but I would expect that the recipe below will work for other generative AI services too, albeit each with their own mileage.

So here’s the result for my first prompt: “Can you create a picture of three bridges?” Not exactly what I had in mind, to say the least, but a nice opportunity to see whether I could do some simple prompt engineering to get better results.

Four images generated by Google’s Gemini using the prompt “Can you create a picture of three bridges?

An obvious improvement, which would be completely unnecessary when talking to a human, was to stipulate that the bridges should span the river, not run parallel along it or halfway through it. The results for “Can you create a picture of three bridges crossing a river?” certainly looked better than for the first prompt, but there was still plenty of room for improvement.

Four images generated by Google’s Gemini using the prompt “Can you create a picture of three bridges crossing a river?

I got better results with the prompt “Can you create a picture of three bridges crossing a river, seen from above?”, as you can see below. There are some ‘interesting’ features in the pictures here and there, and counting to three’s still a challenge for generative AI. But from this result, it’s clear that trying out the same prompt a couple of times has a good chance of producing at least one usable illustration.

Four images generated by Google’s Gemini using the prompt “Can you create a picture of three bridges crossing a river, seen from above?

Notice that within the same picture, the bridges tend to look very similar to each other. In order to add some variation to the type and style of the bridges, I added one last twist to the prompt: “Can you create a picture of two road bridges and one train bridge crossing a river, seen from above?” That gave results as shown below:

Four images generated by Google’s Gemini using the prompt “Can you create a picture of two road bridges and one train bridge crossing a river, seen from above?

Of course, this introduced some new issues, like railroad bridges mysteriously morphing into motorway bridges halfway across the river. But overall, the bridges didn’t look that similar any more, and after running the prompt a couple of times, I finally found the picture that I ended up using.

The final image for the article, generated by Google’s Gemini using the prompt “Can you create a picture of two road bridges and one train bridge crossing a river, seen from above?

Notice that in this final picture, there’s a motorway on the left bank that suddenly becomes much wider halfway between the two motorway bridges, and then suddenly terminates before reaching the railroad bridge. On the other hand, would you be surprised to find a road like that at a place where they’ve also built two motorway bridges so close to each other?

The result is still impressive though, and generating such a picture from a simple prompt would have sounded like pure science fiction only a couple of years ago. But from an engineering standpoint, it’s also interesting to notice that there is a balance to be struck between putting effort into crafting a more effective prompt and simply running a prompt a couple of times to get some acceptable images. Be aware though, that even if the overall picture looks fine, you have to check the details too. That’s also a lesson recently learned by the Danish publisher Forlaget Carlsen, after releasing a children’s book with illustrations produced using generative AI.

Put Ads For Free On FiverrClerks.com

About The Author

Leave a Reply

Your email address will not be published. Required fields are marked *

Copyright © All rights reserved. | Website by EzeSavers.
error: Content is protected !!