跳到正文
DEV Community· Carla·· 2 小時前AI 評分56

Lazy Screenshot Namer 用本機 Gemma 4 為截圖命名並標記假密碼

I let a local Gemma 4 name my screenshots (and it caught my fake password)

AI 導讀

Carla 開發 Lazy Screenshot Namer,使用本機 Gemma 4 分析截圖並建議檔名,同時標記疑似含有密碼或金鑰的圖片。它以 Gemma 4 E2B(gemma4:e2b-it-qat,約 4 GB)透過 Ollama 在沒有 GPU 的筆記型電腦上運行,預設先 dry run,使用 --apply 才重新命名,並將變更記錄到 CSV。

正文

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 3: Slow and Steady

What I Built

Last week, for my Week 2 project, I took a lot of screenshots. Then I spent 10 to 15 minutes doing the most sloth-unfriendly job in the world: opening each Screenshot 2026-10-11 173802.png, figuring out what was in it, pressing F2 and typing a name like ghw-hypertable-show-chunks.png.

Lazy Screenshot Namer does that for me. It looks at every screenshot in a folder with a local Gemma 4 model, describes it, and suggests a short name that says what's inside. It also does one thing I would never bother to do by hand: it flags screenshots that seem to contain a password or a key, before they end up in a repo or a blog post.

Who gets to be lazier: anyone who documents their work with screenshots. Developers writing READMEs and bug reports, students taking notes, anyone with a Screenshots folder full of timestamps.

Demo

Before: eight screenshots with the names Windows gave them.

Screenshots before renaming

The dry run shows what Gemma 4 sees in each image and the name it suggests. Nothing is renamed yet:

Dry run with descriptions

After --apply:

Screenshots after renaming

How close did it get to the names I chose by hand last week?

Suggested by Gemma 4 My own name
sql-show-chunks.png ghw-hypertable-show-chunks.png
sql-time-bucket-devices.png ghw-hypertable-time-bucket.png
search-results-customer-orders.png ghw-pgvector-ricerca.png
sql-note-execution-result.png ghw-pgvector-tabella.png
teapot-inquiry-draft.png demo-teapots.png
customer-service-vase-replacement.png demo-damaged.png
customer-service-package-delay.png demo-late.png
sensitive-config-db-connection-vars.png ⚠️ a fake DB_PASSWORD, made for the test

Not identical, but every name tells you what's inside, and it even read show_chunks and time_bucket straight from the SQL on screen. The one miss: it called my customer notes "customer orders".

Code

GitHub logo carla800 / lazy-screenshot-namer

Rename screenshots with a local Gemma 4 model that describes each image, and flag the ones that seem to contain secrets

Lazy Screenshot Namer

Turns Screenshot 2026-10-11 173802.png into sql-show-chunks.png. A local Gemma 4 model looks at each screenshot, describes it and suggests a name that says what's inside. It also flags screenshots that seem to contain a password or a key, before they end up in a repo or a blog post.

Everything runs on your laptop with Ollama: your screenshots never leave your machine.

Built for the Hacktoberfest 2026 Open-Source AI Challenge, Week 3: Slow and Steady.

Before and after

Screenshots before

Screenshots after

Windows name Suggested by Gemma 4 My own name, chosen by hand
Screenshot 2026-10-11 173802.png sql-show-chunks.png ghw-hypertable-show-chunks.png
Screenshot 2026-10-11 174415.png sql-time-bucket-devices.png ghw-hypertable-time-bucket.png
Screenshot 2026-10-15 140512.png search-results-customer-orders.png ghw-pgvector-ricerca.png
Screenshot 2026-10-15 140748.png sql-note-execution-result.png ghw-pgvector-tabella.png
Screenshot 2026-10-18 223001.png teapot-inquiry-draft.png demo-teapots.png
Screenshot 2026-10-18 223612.png customer-service-vase-replacement.png demo-damaged.png
Screenshot 2026-10-18 223740.png customer-service-package-delay.png demo-late.png
Screenshot 2026-10-25 122211.png sensitive-config-db-connection-vars.png (a fake password, made for testing)

How it works

For each image in a folder:

  1. Describe…

How I Built It

It's a single Python script around Gemma 4 E2B (gemma4:e2b-it-qat, about 4 GB), Google's open-weight model, running locally with Ollama on a laptop without a GPU. Gemma 4 can read images, so for each screenshot:

  1. Describe (with the image): one sentence about what the screenshot shows, plus a line sensitive: yes/no.
  2. Name (text only, fast): turn that sentence into 2 to 5 hyphenated words.
  3. Rename safely: dry run by default, --apply to rename, never overwrite a file, and log every change to a CSV so it can be undone.

Getting there took three wrong turns, and they taught me more than the final code:

  • The 13,706-character file name. My first version asked for a JSON answer. On most screenshots the model got stuck in a loop, repeating words inside the name (...show-chunks-table-data-preview-success-connected-status...) and never closing the JSON. Four minutes per image, zero usable names. Capping the output at 40 tokens fixed both problems at once: about 9 seconds per image.
  • The model copied my example. My prompt said "for example: sql-editor-query-results", and three different SQL screenshots all got exactly that name. Removing the example and asking for "the most specific thing you can read on screen" made them distinct.
  • Describe first, then name. On terminal screenshots, the model latched onto the command (python copilot.py) and ignored the actual content. Asking it to describe the screenshot first, then naming it in a separate call, took me from 2 useful names out of 7 to 7 out of 7. Splitting a task into two simpler steps really helps a small model.

I also learned not to trust the output blindly: the code keeps at most 5 words, strips anything that isn't a letter, a digit or a hyphen, and asks for the sensitive line before the name, so a truncated answer never loses the privacy flag.

As last week, I paired with an AI assistant to move fast, but the testing, the wrong turns and the fixes were all part of the fun.

Why Does Open Innovation Matter?

Screenshots are some of the most private files on a computer. In the last two weeks alone, mine included a database dashboard, query results and, at one point, a real connection string with a password. Sending them to a cloud API just to get a nicer file name would be a terrible trade.

  • Screenshots never leave the laptop. Gemma 4 runs locally with Ollama: no upload, no third-party AI provider seeing your screen.
  • It works offline and costs nothing. No API key, no per-image bill. You can point it at a folder of hundreds of screenshots and let it run, which is the whole point of being lazy.
  • A small open model runs on normal hardware. Gemma 4 E2B reads screenshots well enough on a laptop without a GPU.
  • I could fix what broke. The endless names, the copied example and the ignored content were all fixed by changing things I fully control: the output limit, the prompt and the number of steps. With a closed model I could still change the prompt, but not run it on my own machine for free.

The Lazy Payoff

  • By hand, last week: about 10 to 15 minutes for 7 screenshots (look, think of a name, F2, type).
  • With the namer: 8 screenshots in 25 seconds (from 12:26:49 to 12:27:14 in the rename log), plus about a minute to read the dry run.
  • The bonus I would never have done by hand: checking every screenshot for secrets. It flagged the fake password on the first try, with no false alarms on the other seven.

Prize Categories

  • Best Use of Gemma

來源:DEV Community · dev.to