Back to projects

Novel Image Generator

A browser userscript integrating multiple AI providers to generate context-aware images from selected text on WTR Lab.

5stars1forksTypeScriptLive from GitHub
Novel Image Generator

Overview

Novel Image Generator is a userscript I built for WTR Lab, a web novel reading platform. While reading, you can highlight a passage and the script generates an AI image of the scene using whatever provider you've configured. It's not a productivity tool - it's a reading companion. But the engineering challenge of building it taught me a lot about practical browser automation.

How it works

The userscript injects into WTR Lab pages, intercepts text selection events, and exposes a small UI for triggering generation. It supports multiple AI image providers - some run through hosted APIs, others connect to local models. The provider abstraction means you can swap one for another without changing how the script behaves on the page.

Why a userscript

I picked Tampermonkey/userscript over a browser extension because the audience is small, the install path needs to be lightweight, and userscripts work across browsers without separate manifest files. The cost is sandboxing - userscripts run in a constrained context - but for a reading enhancement, that was the right tradeoff.

What I learned

Building this taught me that the bar for a "fun" tool is the same as the bar for a serious one. If the generation feels slow, or the UI gets in the way of reading, no one uses it. I spent a long time tuning the activation flow so it disappeared into the reading experience. The technical work was easier than getting the feel right.