Skip to content

Optimize ShareX uploads

Crop empty borders, scale down oversized screenshots and compress them before they're saved, without AI or outside services.

Screenshots from a 4K monitor or a window capture with a wide empty margin are bigger than they need to be: slower to open on a phone, slower to load in a chat, and heavier in your storage. This guide builds an intake workflow that fixes every image ShareX uploads before it reaches your library. It removes metadata, trims the empty border, and only scales down and compresses images that are actually large. ShareX's link works as usual and shows the optimized image.

  1. File received (trigger)PNG, JPEG and WebP
  2. Strip metadata
  3. Auto-cropTolerance 8
  4. Large or heavy?Wider or taller than 2560, or over 1 MiB
    • True
      1. ResizeFit 2560 × 2560
      2. Compress imageQuality 80
      3. Save fileAs the upload
    • False
      1. Save fileAs the upload

What you'll build

BeforeAfter
Dimensions3840 × 21602560 × 1400
Empty border420 px of white at the sides, 260 px above and belowTrimmed
Size993 KB880 KB as PNG, or 54 KB as WebP (see Convert to WebP instead)
MetadataWhatever the capture tool wroteNone

These are verified results from the sample below. Smaller screenshots skip the resizing and compression and are saved after cropping, so they keep their quality.

Before you start

DifficultyBeginner
TimeAbout 10 minutes
Workflow kindUpload intake
ConnectionsNone
Folders, tags, fieldsNone
Sample filesharex-window-capture.png: a 3840 × 2160 window capture with a white border

You need a ShareX token to send uploads through it; see Configure ShareX. Read Upload intake if you want to know how intake differs from the other workflows.

Build the workflow

Create it

Open Automations › Workflows, click New workflow, name it Optimize ShareX uploads, 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 saves it as the upload.

Choose which files it handles

Select File received and set File types to image/png, image/jpeg and image/webp, one per line.

GIFs are left out on purpose: the image steps keep only a GIF's first frame, so an animated GIF would stop moving. With Automatic intake, files the trigger doesn't accept are saved as they are.

Strip metadata

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

Its Content is suggested as File received › Content. It turns the image upright from its EXIF orientation, then drops EXIF, location and other metadata. Save file now reads Strip metadata's content.

Trim the empty border

Insert Auto-crop on the connection between Strip metadata and Save file the same way. Its Content is Strip metadata › Content.

Auto-crop takes the color of the top-left pixel as the border and trims rows and columns of it from every edge. Tolerance, under Advanced, is how far a pixel may differ from that color and still count as border. Keep the default 8; raise it to around 20 for JPEG captures, whose borders are rarely one exact color.

Decide what's large

Insert a Condition on the connection between Auto-crop and Save file. Open its Step actions (the three dots), choose Rename, and call it Large or heavy?.

Click Configure step, set Match to Any rule, and add three rules. For each Value, choose From a step and pick the value from File received › Content:

ValueOperatorCompare with
File received › Content › Widthis greater than2560
File received › Content › Heightis greater than2560
File received › Content › Sizeis greater than1048576

Size is in bytes, so 1048576 is 1 MiB. The rules look at the upload as it arrived, which is what makes it slow to load.

A Condition has two outputs, so inserting it leaves Save file unconnected. Drag from the Condition's False output to Save file. Images that aren't large are saved as soon as they're cropped.

Scale down large images

Click the + beside the Condition's True output and choose Resize.

  • Content: suggested as Auto-crop › Content. Keep it.
  • Max width: 2560
  • Max height: 2560

Resize keeps the proportions and never enlarges an image unless you turn on Enlarge smaller images. An image that's only large because of its border may already fit once it's cropped; Resize then passes it on unchanged.

Compress

Click the + after Resize and choose Compress image. Its Content is Resize › Content. Keep Quality at 80.

Compress image keeps the format: JPEG and WebP are compressed at that quality, PNG without loss. If the result isn't smaller, it keeps its input, so this step never makes a file bigger.

Save the large ones

Click the + after Compress image and choose Save file.

  • Content: Compress image › Content.
  • Save as: The upload.

Leave Name and Folder empty to keep the upload's name and the folder it was sent to.

Each branch now ends in a Save file that saves the upload. That's allowed because they're on different outputs of the same Condition, so exactly one of them runs.

Test it

  1. Upload the sample file to your library from the browser, so you have something to test with. If this workflow is already active, upload it with the workflow turned off.
  2. In the editor, click Test, choose the sample, and click Start test.
  3. Select each step to see what it did. Auto-crop's log says Trimmed to 3001×1641. The Condition takes True because the width is over 2560. The Save file on the True branch shows the file it would save: 2560 × 1400.

The file stands in for an upload, and nothing is saved to your library. Image steps run for real in a test, so the sizes you see are the sizes you'll get. See Testing.

Turn it on

  1. Click Publish, then turn on Active.
  2. Open Settings › API tokens, click Intake on your ShareX token, and choose A specific workflow › Optimize ShareX uploads.
  3. Set Wait for processing to 5 seconds. ShareX then gets its link once the optimized file is saved, so the link works the moment you paste it.

With A specific workflow, a file the trigger doesn't accept, such as a GIF or a PDF, is refused with intake_rejected. If you also upload other files with this token, choose Automatic instead: those files are then saved as they are, and this workflow handles the images. See Choosing a workflow.

What to expect

A verified run on the sample, as the run page shows it:

StepResult
Strip metadataSucceeded
Auto-cropTrimmed to 3001×1641.
Large or heavy?True: rule 1 (width) matched
Resize2560 × 1400
Compress imageCompressing didn't make the image smaller, so it was kept as it was.
Save filesharex-window-capture.png, 2560 × 1400, 880 KB

Compress image kept the resized PNG here because the PNG encoder had already done its best. On JPEG screenshots, quality 80 usually saves more. For PNG, converting to WebP makes the real difference.

The upload's links never change. While the run works, a raw link waits up to 20 seconds and the share page shows a processing page; see How an upload goes through intake.

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. Avenvail 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 set to An additional file can keep the full-size image in an Originals folder by reading Strip metadata › Content.

Troubleshooting

ProblemCause and fix
ShareX shows intake_rejectedThe token uses this workflow as A specific workflow, and the file isn't PNG, JPEG or WebP. Switch the token to Automatic, or add the type to File types.
ShareX shows intake_unavailableThe workflow is turned off, unpublished or deleted. Publish it and turn on Active.
The pasted link shows a processing pageThe workflow hadn't saved the file yet. Raise Wait for processing on the token.
Nothing was croppedThe top-left pixel isn't border colored, for example a window shadow or a rounded corner. Raise Tolerance, or remove Auto-crop for captures without a border.
Too much was croppedA screenshot whose edge is the same color as its content, such as a white page, loses that edge. Lower Tolerance, or limit the workflow to one ShareX token used for window captures with Tokens on File received.
The saved file is larger than the uploadStrip metadata and Auto-crop save a new copy of the image, and a PNG that was already well compressed can come out slightly larger. Convert to WebP, or remove Strip metadata if your captures have no metadata.
The resize was lostSave file reads an earlier step's content. See Check what Save file reads.
The upload is in quarantineA step failed, for example on a damaged image. Open Automations › Quarantine, check the error, then Release it as it was or Retry run. See Quarantine and failures.

Make it your own

Convert to WebP instead

Replace Compress image with Convert image: Format WebP, Quality 85. On the sample, this saved 54 KB instead of 880 KB (verified), and the file's name ends in .webp. Its link stays the same. Lossy WebP can soften small text, so check a few screenshots at full size before you settle on a quality.

Keep the original too

Add a second Save file after Strip metadata with Save as set to An additional file, Content Strip metadata › Content, and Folder Originals. Each upload is then saved twice: the optimized file under its usual link, and the full-size original in Originals.

Other limits

Change 2560 in the rules and in Resize together. 1920 suits screenshots you mostly share in chats; 3840 keeps 4K captures sharp while still trimming borders.

Sort as you save

Set Folder and Subfolders on both Save file steps, such as Screenshots with {{ trigger.content.receivedAt | date: 'yyyy/MM' }}, to file uploads by month. Set the workflow's Time zone in its Settings tab, so months start at your midnight rather than UTC's.

Privacy, cost and reliability

  • Everything runs on your Avenvail server. Nothing is sent to an outside service, and nothing costs money per upload.
  • Strip metadata removes location and camera details, which matters for anything you share. Turning it off keeps them in the saved file.
  • An intake run has an hour to save the upload. If it fails, the upload waits in quarantine for 30 days by default, and its link answers 404 until you retry or release it. Choose Save as received under When a run fails if a working link matters more to you than the processing; the unprocessed file, metadata included, is then saved instead.