Skip to content
Dashboard

Uploaders

The upload script: one file, any tool

What hematite's upload script does: it uploads the image it's given, prints the link and copies it. How to run it, what it needs, what it says when it fails.

This page as Markdown

Screenshot tools that have no upload of their own can still send each capture to hematite: they run hematite's upload script with the capture's path, and the script uploads it and prints its link. Flameshot, ksnip and Greenshot have their own guides; any other tool that runs a command with a file's path works the same way.

Get it

On Settings → Uploaders, press Download script beside the tool you use. Each download is the same script with a new upload token in it, listed under that tool's name. It comes in two forms:

FileForNeeds
hematite-upload.shmacOS and Linux (Flameshot, ksnip)sh and curl, which both systems have
hematite-upload.ps1Windows (Greenshot)Windows PowerShell 5.1, in every Windows 10 and 11, or PowerShell 7
hematite-upload.cmdWindows, for ksnip, which starts a .cmd but not a .ps1The same: its first lines start the PowerShell script under them

Run it

macOS and Linux
sh hematite-upload.sh screenshot.png
Windows
powershell -NoProfile -ExecutionPolicy Bypass -File hematite-upload.ps1 screenshot.png
  • Done, it prints the link and nothing else, and copies it: with pbcopy on a Mac, wl-copy on Wayland, xclip or xsel on X11, whichever is there; on Windows, to the clipboard.
  • It takes a PNG, JPEG, GIF or WebP of up to 16 MB, told by the file's first bytes, not its name.
  • - instead of a file uploads the image on standard input: flameshot gui --raw | sh hematite-upload.sh -.
  • Flameshot's script captures first when it's run without a file.

Its uploads take your upload settings and their link follows your link settings, as every upload's does.

The token inside

The script holds an upload token, which can upload to your account and do nothing else, for 90 days from the download. Keep the file to yourself: on macOS and Linux, chmod 700 hematite-upload.sh lets only you read it. The script never prints the token, and hands it to curl on standard input rather than on its command line, where anyone on the computer could read it. If the file gets out, remove its token on Settings → Uploaders or Settings → Security, and download a new script.

When it fails

It says why on standard error, starting hematite:, and ends with 1. Run it by hand in a terminal to read it.

It saysWhat to do
hematite refused the upload keyThe token expired or was removed: download a new script
Your storage is fullDelete something, or see pricing
… isn't a PNG, JPEG, GIF or WebPSave captures as PNG or JPEG
… is 18 MB; hematite takes images of up to 16 MBSave a smaller capture, or as JPEG
Too many uploads at onceWait a moment: uploads go at 60 a minute
Couldn't reach hematiteCheck the connection; the rest of the line says what curl or Windows met

API errors and rate limits has every answer the API can give.