Skip to content

Web Interface ​

mediatoolz ui starts a small web server on your own machine and opens a page in the browser. The page runs the commands of this package with forms, tables and previews instead of flags: pick folders in a file browser, compare an image before and after, and see the placeholders decoded next to each image. Nothing leaves your machine.

bash
mediatoolz ui
text
mediatoolz ui is running at http://127.0.0.1:52144/?token=5f3c…
Press Ctrl+C to stop.

The browser opens at that address by itself. The menu on the left lists the modules: Image Hash and Image Batch.

Starting it ​

Run the command anywhere. The folder it is started from is the starting folder of the file browser and the default project: the place where project-wide configs and presets are kept. --cwd <path> starts it from another folder, and the project can be changed on the page itself.

By default the server picks a free port (--port <n> sets one) and listens on 127.0.0.1, so only this machine can reach it. --no-open only prints the address. Ctrl+C stops the server.

The interface is part of the package, so there is nothing else to install. Both modules use the sharp library, which comes with the package too.

Safe by design ​

  • Only this machine. The server listens on 127.0.0.1. The address printed on start carries a one-time token: opening it sets a cookie, and every request after that must carry the cookie. A request with a foreign Host or Origin header is refused.
  • Writing is always explicit. Image Hash writes a file only when you ask for one, and asks before replacing an existing file. Image Batch writes only into the folder you choose, next to the originals when you pick that, or over them with a backup and a confirmation.
  • Secrets are not needed. The interface asks for no account and no key, and makes no request to the network except the ones you give it as image URLs.

Image Hash ​

The image-hash command with a visual result. Add folders and images with the file browser (it shows thumbnails) and see right away how many images, in how many folders and how many bytes were found. Tick the placeholders (hazehash and dominant color are ticked at the start; blurhash, thumbhash and a tiny preview are off), set the hazehash size and the blurhash components, and choose the output format.

The result is a gallery: every image next to the placeholders decoded from its hashes, so you see what a page would show while the image loads. Click a card for a large view that you can step through with the arrow keys. The Output tab holds the same data as the command would print, ready to copy, download, or write to a file (the page asks before replacing one).

Image Batch ​

The image-batch command in four sections. The header shows the project folder: it is what “This project” means wherever a config or a preset can be saved, and “All projects” is your home folder.

  • Convert — choose the images, then where the results go: a separate folder, next to each original, or over the originals. Then say what to do, either with quick settings (an optional Resize the images switch with its size method — off by default, so the images are only converted to the chosen format — then formats, quality, a file size limit, a file name template with its variables and a live example, sharpening) or by choosing a saved config. Preview shows the plan without writing, Convert does it, with a progress bar and a list of before and after thumbnails, sizes and savings. Replacing the originals asks for confirmation, keeps each file in its own format and makes a backup.
  • Configs — the saved configs of the project and of your home folder. Create one, edit it with a form (sizes, formats, quality, names, sharpening for each recipe, plus defaults for all of them) or as JSON, and see at once whether it is valid and what it will produce. Duplicate or delete a config; a deleted one leaves a .bak copy.
  • Sharpening — the saved sharpening presets and the six built-in ones. The editor takes the target, the amount and the fine settings, shows what the sharp library receives, and previews the result on any photo you pick, with a slider to compare before and after.
  • Backups — the backups that replacing originals made, newest first. Open one to see each file as it was and as it is now, what can be restored, and what was changed since. Restore puts the originals back; files edited after the replacement are left alone unless you tick the box. A backup that lives in another folder can be opened by its path.

Options ​

--port <n> ​

The port to listen on. The default, 0, picks a free one.

--host <address> ​

The address to listen on. The default, 127.0.0.1, keeps the interface on this machine. Anything else makes it reachable from the network, over plain HTTP, protected only by the token: leave it alone unless you know why you need it.

--no-open ​

Print the address and do not open the browser.

--token <value> ​

Use this access token instead of a random one. For development.

--cwd <path> ​

The folder the interface starts in. The default is the current folder.

--plain ​

Turn off color and the banner, even in a real terminal.

--color ​

Force colored output even when piped.

Problems and exit codes ​

  • A port that is taken: error: port 4000 is already in use — pick another with --port, or leave it out, exit code 1.
  • A port that is not a whole number from 0 to 65535: exit code 2.
  • Stopping with Ctrl+C is a normal exit, code 0.
  • If the page cannot reach the server any more (it was stopped), reload the page from the address that the command printed.