Guides

Compress and resize uploads

An intake workflow that strips metadata, scales down and compresses images before saving them to your library.

This guide builds the most common intake workflow: every image you upload (from ShareX or the browser) has its metadata removed, is scaled down to fit 2560 × 2560, and is compressed before it's saved. Other files are saved as they are.

The finished workflow looks like this:

File received → Strip metadata → Resize → Compress image → Save file (as the upload)

Each content step reads the content from the step before it, and Save file reads the last one. Getting that chain right is the one thing to watch; the last section explains why.

Create the workflow

Open Automations, click New workflow, name it Shrink images, and choose Upload intake as the kind.

The editor opens with File received connected to Save file. Save file already reads the upload (Content is File received › Content) and has Save as the upload turned on.

Limit it to images

Select File received and set File types to image/*.

Which other files go through this workflow depends on how you assign it. With Automatic intake, non-image uploads don't match and are saved as they are. With the workflow assigned to a token as A specific workflow, non-image uploads with that token are refused. If you upload other files with the same token, use Automatic.

Strip metadata

Hover the connection between File received and Save file and click the + in its middle. Choose Strip metadata from the Content group.

Strip metadata gets Content = File received › Content as a suggestion, and Save file now reads Strip metadata's content. The image is turned upright from its EXIF orientation, then saved without EXIF, location or other metadata.

Resize

Hover the connection between Strip metadata and Save file, click +, and choose Resize.

  • Content: suggested as Strip metadata › Content. Keep it.
  • Max width: 2560
  • Max height: 2560

Resize keeps the proportions and only scales images down. Smaller images pass through unchanged unless you turn on Enlarge smaller images under Advanced.

Compress

Insert Compress image between Resize and Save file the same way. Its Content is Resize › Content.

  • Quality: 80 (the default) is a good start. It applies to JPEG and WebP; PNG is compressed without loss.

Compress keeps the image's format. If compressing doesn't make the file smaller, it keeps the input as it was, so this step never makes things worse.

To change the format too, use Convert image instead of (or before) Compress image. It saves PNG, JPEG or WebP (WebP by default) with a quality you choose.

Check Save file

Select Save file and confirm Content reads Compress image › Content. While you're there, you can set:

  • Folder and Subfolders, for example Screenshots with subfolders {{ trigger.content.receivedAt | date: 'yyyy/MM' }}. Leave Folder empty to keep the folder the upload was sent to.
  • Name, to rename the file. Empty keeps the content's name. Converting changes the extension to match.
  • Tags and Tag names.
  • Create a share link, if the upload didn't already ask for one.

Test

Click Test and choose an image from your library. It stands in for an upload. Select each step to see what it produced: Resize shows the new width and height, Compress image the new size. Nothing is saved to your library during the test.

Publish, turn it on, and assign it

Click Publish, then turn on Active.

Then decide which uploads use it. Uploads from the browser and from tokens set to Automatic pick it up straight away, because it's an enabled intake workflow whose trigger accepts images. To be sure your ShareX token always uses it, open Settings › API tokens, click Intake on that token, and choose A specific workflow › Shrink images. Consider setting Wait for processing to a few seconds so the link ShareX copies works the moment you paste it.

Check what Save file reads

Every content step makes a new copy of the content and leaves its input alone. Save file stores whichever copy its Content setting points to. If that's not the last step's output, the work done after it is silently thrown away:

File received → Strip metadata → Resize → Save file
Save file's ContentResult
Strip metadata › Content✗ The resize is lost
Resize › Content✓ The resized image is saved

The run still succeeds, so this is easy to miss. Tessra helps in two ways:

  • Inserting a step on a connection rewires the next step. When you insert a content step between two others, the step after it switches to the new step's content, as long as it was reading the same content the new step reads. That's why the steps above didn't need fixing by hand.
  • The Problems list warns you. If Save file reads content that an earlier step on its path has already changed, you get a warning that names the step to read from instead.

Nothing is rewired when you add a step at the end of the workflow, connect steps by hand, or delete a step. After any of those, select Save file and check its Content. Its value tree lists the content steps nearest first.

The warning doesn't block publishing, because reading earlier content on purpose is sometimes what you want. For example, a second Save file without Save as the upload can keep the full-size image in an Originals folder by reading Strip metadata › Content.

Variations

Keep the original too. Add a second Save file after the first, with Save as the upload off, Content = File received › Content and Folder = Originals. The original is saved as a separate file with its metadata intact, so keep that folder private.

Only resize large images. Insert a Condition before Resize with the rule File received › Content › Width is greater than 2560. Put Resize and a Save file on True, and another Save file reading Strip metadata's content on False. Turn on Save as the upload in both: they're on different branches of the same Condition, so only one of them runs.

Convert everything to WebP. Replace Compress image with Convert image, format WebP, quality 85. Files saved this way get a .webp extension.