Name screenshots with AI
Replace random ShareX file names with short descriptive ones, safely, and keep the original name when the AI has no answer.
chrome_Xk2p9QzL.png tells you nothing, in a file list, a search, or a download folder. This guide builds a small library workflow that looks at each new screenshot, asks an AI model for a short descriptive name, cleans that answer into a safe file name, and renames the file. When the AI service is down or has no answer, the file keeps its original name and gets a needs-name tag, so nothing is lost and nothing is renamed to nonsense.
It's also the simplest example of using an AI step's answer in a later step, which the other AI guides build on.
- File uploaded (trigger)PNG, JPEG and WebP
- Load content
- Write a file nameAI generate text · continues if it fails
- Got a name?Text exists
- True
- RenameDate and cleaned name
- False
- Add tagsneeds-name
- True
What you'll build
| Upload | The AI answers | Saved as |
|---|---|---|
screenshot-build-error.png | vite build error typeerror in orderlist | 2026-12-02 vite-build-error-typeerror-in-orderlist.png |
| A chat screenshot | Group chat: planning a Saturday hike / ridge trail! | 2026-12-02 group-chat-planning-a-saturday-hike-ridge-trail.png |
| Any screenshot, while the AI service is down | (nothing) | Original name, tagged needs-name |
The renaming is verified; the AI's answers are illustrative. The second answer breaks every rule in the prompt, which is why the name is cleaned before it's used.
Before you start
| Difficulty | Beginner |
| Time | About 10 minutes |
| Workflow kind | Library workflow |
| Connections | An AI connection whose model takes images |
| Models | Any image model. Naming is a small task: gemma3:4b on Ollama or a small hosted model, such as gpt-4.1-mini, does it well. |
| Folders, fields | None |
| Tags | needs-name is created the first time it's needed |
| Sample file | screenshot-build-error.png |
If you also follow Build a self-organizing screenshot library, it already names files. Use this guide on its own, or to understand that part.
Build the workflow
Create it
Open Automations › Workflows, click New workflow, name it Name screenshots, keep Library workflow, and choose File uploaded. Set its File types to image/png, image/jpeg and image/webp.
Load the image
Add Load content after the trigger.
Ask for a name
Add AI generate text, rename it Write a file name, and click Configure step.
- Connection: your AI connection.
- Add image input, then Image: Load content › Content.
- What to write:
Write a file name for this screenshot. - 3 to 6 lowercase English words separated by spaces. - Say what it shows, most specific first, and name the app or website when it's visible. - No dates, no file extension, no punctuation, no quotes. Answer with the name only.
On the Advanced tab:
- Under Generation settings, set Temperature to
0.2for steady, plain answers, and Max output tokens to40, so a chatty model can't write a paragraph. - Under Execution, set If this step fails to Continue. When the model can't be reached, the run carries on without a name instead of failing.
Tessra tells the model to answer with the text only, without Markdown or quotes. Models don't always listen; the next steps deal with that.
Check there's an answer
Add a Condition, rename it Got a name?, with one rule: Value from a step, Write a file name › Text, operator exists.
When Write a file name failed, its text doesn't exist, and the run takes False. An empty answer counts as a failure too, so it takes False as well.
Rename the file
From True, add Rename and set New name to a template:
{{ subject.createdAt | date: 'yyyy-MM-dd' }} {{ steps.generate-text.text | optional | slug | truncate: 60 | slug }}
Leave Keep the extension on. What each part does:
| Part | Why |
|---|---|
subject.createdAt | date: 'yyyy-MM-dd' | The upload date first, so names sort by date, two screenshots of the same thing rarely collide, and the name is never empty. |
steps.generate-text.text | The model's answer. generate-text is the id Tessra gave the step; insert it from the list if yours differs. |
optional | Tells the editor the value may be missing. The Condition already makes sure it isn't, but without it the editor reports an error, because the step could fail. |
slug | Lowercases the answer, keeps only the letters a to z and digits, and joins words with dashes. Slashes, colons, quotes, emoji and line breaks can't reach the file name. Accented letters lose their accents. |
truncate: 60 | Keeps at most 60 characters of it, so a rambling answer can't make a 255-character name. |
The second slug | Removes a dash that truncate may have left at the end. |
Keep the extension adds the file's own extension, such as .png, so the file still opens in the right app even if the model suggested another one.
Mark the ones without a name
From False, add Add tags, and under Tags type needs-name and choose Create. Filtering Files by that tag shows the screenshots to name by hand or to run again later.
Test it
- Upload the sample with the workflow inactive.
- Click Test, choose it, turn on Allow sending content to outside services, and click Start test.
- Select Write a file name to see the answer, and Rename to see the name the file would get. The real file isn't renamed during a test.
Without Allow sending content to outside services, the AI step returns a placeholder and Rename shows a name made from it. That checks the template, not the model.
Turn it on
Click Publish, then turn on Active. Every new PNG, JPEG or WebP image in your library gets a name within a few seconds of being uploaded. Its links don't change.
What to expect
Verified runs, with illustrative AI answers:
| Case | Path | Result |
|---|---|---|
| A clean answer | True | 2026-12-02 vite-build-error-typeerror-in-orderlist.png |
| An answer with punctuation and a slash | True | 2026-12-02 group-chat-planning-a-saturday-hike-ridge-trail.png |
| The AI service answered 503 | False after three attempts | The original name, tagged needs-name; the run is Completed with errors |
Troubleshooting
| Problem | Cause and fix |
|---|---|
Names are generic, such as screenshot of a website | The model is too small or doesn't read text well. Try a larger image model, or add Use the most distinctive words visible in the image to the prompt. |
| Names are in another language, or empty after the date | slug keeps only a to z and digits, so an answer in Japanese, Greek or Cyrillic leaves nothing. Keep English in the prompt, or see Keep other languages. |
Every file gets needs-name | Write a file name fails every time. Open a run and read the step's error, such as connection_unreachable or ai_model_missing_feature for a model that doesn't take images. |
reference_conditional error on Rename | The template uses the AI's text without optional or default. Add optional after the value, as above. |
| Files that already had good names are renamed | The workflow names every image. Limit File types, set the trigger's Folder, or add a rule to Got a name?, such as Current file › Original name starts with chrome_. |
The name ends in .png.png or -png.png | The model added an extension. Keep no file extension in the prompt; slug turns its dot into a dash. |
Make it your own
Keep the original name in the new one
Use {{ steps.generate-text.text | optional | slug | truncate: 50 | slug }} ({{ subject.originalName }}) to keep the ShareX name for reference, or set a field to it before renaming.
Keep other languages
Replace slug with replace filters that only remove what file names can't hold, such as {{ steps.generate-text.text | optional | replace: '/', ' ' | replace: '\', ' ' | truncate: 60 }}, and ask for the name in your language.
Name existing files
Build the same steps in a workflow whose trigger is Run manually, then select files in Files and choose More actions › Run automation. Filter by the needs-name tag to retry the ones that failed.
Name files before they're saved
The same steps work in an intake workflow: give AI generate text the upload (File received › Content) as its image, and use the template as Save file's Name instead of a Rename step. The upload then waits for the model before it's saved, so keep If this step fails on Continue, and use default: 'screenshot' instead of the Condition, because both branches would need their own Save file.
Privacy, cost and reliability
- Each image is sent once to the address of your AI connection. With a hosted service, it receives your screenshots under its own terms; a local model keeps them on your network.
- With a hosted service, each image costs one request: an image of about 1,600 tokens in, and at most 40 tokens out with the setting above.
- When the service fails, the step tries three times over about a minute and a half before the run continues. Renaming never blocks the upload itself, and the file is usable the whole time.
- Renaming only changes the name you see. The file's content, links and share pages stay the same.