How to Crop a Screenshot on Linux
Crop Linux screenshots with Spectacle, GNOME Screenshot, Flameshot, or exact ImageMagick commands for repeatable and batch workflows.
To crop a screenshot on Linux, either select the rectangle while capturing or crop an existing image with ImageMagick. For a one-off selection, use Spectacle on KDE, Screenshot on GNOME, or Flameshot on any desktop. For exact, repeatable, or batch crops, run:
magick input.png -crop 800x600+100+80 +repage output.png
The geometry is WIDTHxHEIGHT+X+Y: width and height are the retained rectangle, and X/Y are its top-left coordinates in the original image. +repage removes the old virtual-canvas offset so later operations use the cropped image’s own origin.
Choose the right Linux method
| Need | Best choice | Why |
|---|---|---|
| Draw a region and save quickly | KDE Spectacle or GNOME Screenshot | The region is selected before the file is created. |
| Annotate, copy, or blur before saving | Flameshot | Its editor opens after selection. |
| Exact coordinates or fixed dimensions | ImageMagick | The geometry is deterministic and scriptable. |
| Many files or a repeatable pipeline | ImageMagick | Shell globs and numbered output names support batch work. |
On Wayland, prefer your desktop’s native or portal-aware capture path. You can then use ImageMagick for deterministic post-cropping.
Crop while taking the screenshot
KDE Plasma: Spectacle
- Open Spectacle.
- Choose Rectangular Region.
- Drag around the content. Move the rectangle with the arrow keys; hold Shift for fine movement; hold Alt with an arrow key to resize.
- Press Enter or double-click to capture, then save the image.
Spectacle also offers full-screen, monitor, active-window, and window-under-cursor modes.
GNOME: Screenshot
- Open the Screenshot utility.
- Select the user-defined-area option.
- Drag the rectangle and confirm the capture.
- Choose the destination and image format.
GNOME Screenshot can also capture the whole screen or a window.
Any desktop: Flameshot
- Launch Flameshot and choose its GUI capture.
- Drag over the region.
- Use the editor to annotate, copy, or save it.
Hold Ctrl while dragging to preserve the aspect ratio. Hold Shift while resizing to mirror the resize on the opposite handle. On Wayland, configure Flameshot’s documented GNOME or KDE portal backend if direct capture is unavailable.
Crop an existing screenshot with ImageMagick
Install and verify
# Debian or Ubuntu
sudo apt install imagemagick
# Fedora
sudo dnf install ImageMagick
# Arch Linux
sudo pacman -S imagemagick
magick -version
Use the crop geometry
magick input.png -crop 800x600+100+80 +repage output.png
Coordinates start at the original image’s top-left corner. Check dimensions first with:
identify input.png
Batch-crop images
mkdir -p cropped
magick '*.jpg' -crop 120x120+10+5 cropped/thumbnail%03d.png
The numbered pattern creates thumbnail000.png, thumbnail001.png, and so on. Quote the input glob so the shell does not expand it first.
Choose an output format
magick input.png -crop 800x600+100+80 +repage output.png
magick input.png -crop 800x600+100+80 +repage -quality 90 output.jpg
magick input.png -crop 800x600+100+80 +repage output.webp
PNG suits text and interface screenshots. JPEG is smaller for photographic content but adds compression artifacts. WebP is useful when your delivery stack supports it.
Coordinate and scaling details
- Device-pixel ratio: screenshots may use physical pixels while pointer tools use logical pixels. Check display scaling if the crop is twice as large or small.
- Multiple monitors: a combined desktop can have negative coordinates or an origin on another monitor. Check the image dimensions before choosing coordinates.
- Browser zoom: keep zoom fixed when coordinates must remain repeatable.
- Alpha: cropping preserves transparency. Flatten explicitly with
magick input.png -background white -alpha remove -alpha off output.pngwhen needed. - Virtual canvas: use
+repageafter cropping before compositing or creating a sprite sheet.
Or skip the browser setup
If the source is a web page rather than your local desktop, ScreenshotNeo returns a cropped element or full-page shot through one API request. It removes cookie banners, popups, and chat widgets before capture. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed. Its MCP server lets Claude, Cursor, and other MCP clients take screenshots.
See the complete options in the ScreenshotNeo API documentation.
cURL
curl -G "https://api.screenshotneo.com/v1/shot" \
-d access_key=YOUR_API_KEY \
--data-urlencode url=https://stripe.com \
-o shot.webp
Python
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)
Node.js
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`${res.status} ${res.statusText}`);
const file = Buffer.from(await res.arrayBuffer());
require('fs').writeFileSync('shot.webp', file);
ScreenshotNeo supports full-page capture, CSS-selector element capture, device presets, retina scale, custom CSS and JavaScript, waits, request blocking, headers, cookies, geolocation, resizing, caching, signed links, asynchronous jobs, webhooks, bulk capture, PDFs, and HTML/CSS-to-image. Responses include X-Page-Verdict and X-Billed headers.
Try ScreenshotNeo free: 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
| “command not found” | ImageMagick is not installed or is missing from PATH. |
Install it for your distribution and run magick -version. |
| Crop is shifted | Logical and physical pixels differ. | Compare identify dimensions with display scaling. |
| Later compositing has an offset | The virtual canvas still contains the source offset. | Add +repage after -crop. |
| Wayland capture is blank or denied | The application lacks portal permission. | Use GNOME Screenshot or Spectacle, or configure Flameshot’s portal backend. |
| Batch files are overwritten | Output names are identical. | Use a numbered pattern such as %03d. |
| ScreenshotNeo returns an error | Invalid key, malformed URL, or an unrenderable page. | Check the key and URL, inspect HTTP status and X-Page-Verdict/X-Billed, then adjust waits, blocking, or authentication options. |
Performance, reliability, and cost
- Region capture avoids writing a full-screen file. ImageMagick is local and generally limited by image size, format conversion, and disk I/O.
- For automation, record source dimensions, crop geometry, ImageMagick version, display scale, and output format.
- For web pages, use a suitable cache TTL, wait for a known selector, and block unnecessary resources. ScreenshotNeo reports cache hits without billing them.
- ScreenshotNeo includes 1,000 free shots monthly, then Starter $5/3,000, Growth $15/15,000, Pro $39/60,000, Scale $99/250,000, and Business $249/1,000,000. Yearly billing gives two months free.
FAQ
Can I crop without saving a full-screen screenshot?
Yes. Select a rectangular region in Spectacle, GNOME Screenshot, or Flameshot before confirming.
What does +repage do?
It clears the source image’s virtual-canvas offset after cropping.
How do I crop the same area every time?
Measure the rectangle once, store WIDTHxHEIGHT+X+Y, and run the ImageMagick command in a script.
Which tool is best for annotations?
Flameshot, because its selection flow opens an editor for markup, copying, and saving.


