n8n workflow template · 11 nodes · Google Gemini
Easy Image Captioning with Gemini 1.5 Pro is a free n8n workflow template that starts when you run it manually in the n8n editor and works with Google Gemini. It has 11 nodes, 3 of them AI nodes (Google Gemini Chat Model, Structured Output Parser and Basic LLM Chain). The notes inside the workflow say: “Additional, we'll use the Edit Image node to overlay the generated caption onto the image. This can be useful for publications or can be repurposed for copyrights and/or watermarks.” To run it, you add your own credentials for Google Gemini (PaLM) API.
The text below comes from the sticky notes inside the workflow. We removed links, code samples and anything that looks like a key or token.
Additional, we'll use the Edit Image node to overlay the generated caption onto the image. This can be useful for publications or can be repurposed for copyrights and/or watermarks.
Join the Discord or ask in the Forum!
Learn more about the Basic LLM Chain
n8n's basic LLM node supports multimodal input by allowing you to specify either a binary or an image url to send to a compatible LLM. This makes it easy to start utilising this powerful feature for visual classification or OCR tasks which have previously depended on more dedicated OCR models.
Here, we've simply passed our image binary as a "user message" option, asking the LLM to help us generate a caption title and text which is appropriate for the given subject. Once generated, we'll pass this text along with the image to combine them both.
Read more about the Edit Image node
Finally, we’ll perform some basic calculations to place the generated caption onto the image. With n8n's user-friendly image editing features, this can be done entirely within the workflow!
The Code node tool is ideal for these types of calculations and is used here to position the caption at the bottom of the image. To create the overlay, the Edit Image node enables us to insert text onto the image, which we’ll use to add the generated caption.
FIG 1. Example input image with AI generated caption
The text below comes from the sticky notes inside the workflow. We removed links, code samples and anything that looks like a key or token.
Read more about the HTTP request node
For this demonstration, we'll grab an image off Pexels.com - a popular free stock photography site - by using the HTTP request node to download.
In your own workflows, this can be replaces by other triggers such as webhooks.
The 11 nodes in file order (sticky notes excluded). Branches and connections determine execution order in n8n:
Configure your own credentials after importing. Create each credential in n8n, then select it in the node.
Do you need somewhere to run it? Read our guide to self-hosted n8n.
We can adapt this workflow to your apps, data and process, then deploy and support it.
Contact Us