Trim Image Whitespace

Crop the empty border from a JPEG, PNG or WebP image and keep the part that has content.

Files stay on your device No sign-up Free to use
How this works

The tool runs in this browser. Your file or text is not uploaded to UseFreeTools. Check this tool's limits for anything it may save on your device.

Privacy details

Trim borders controls

Drop your image here

or choose one from your device

One JPEG, PNG or WebP image, up to 64 MiB and 40 megapixels.

    The top-left pixel is the usual background. Choose a colour when the border is a paper or scanner shade.

    Used only when Border colour is set to a colour you choose.

    How far a border pixel may differ from the reference and still count as border. Scanned paper usually needs a larger number than a flat background.

    Blank space added around the content after the border is removed. It is clamped to the image edges.

    How to use Trim Image Whitespace

    1. Choose one JPEG, PNG or WebP image, up to 64 MiB and 40 megapixels.
    2. Leave Border colour on the top-left pixel, or set the paper or background colour that your scan uses.
    3. Raise the tolerance when the border is not perfectly even, lower it if pale content is being trimmed away, and add padding when the cut needs a little breathing room.
    4. Select Trim borders, compare the reported sizes and download the trimmed copy.

    Example: Trim Image Whitespace

    A white scan or screenshot with a wide margin around the one block of content.

    You add
    scan.png, a 60 by 40 pixel white image with a 30 by 20 pixel block of dark content at x=10, y=10. Border colour from the top-left pixel, Tolerance 8, Padding 0, Output format PNG.
    You get
    scan-trimmed.png at 30 by 20 pixels. The result reports the original 60 by 40 pixels, the trimmed 30 by 20 pixels, 10 pixels removed from the left, 10 from the top, 20 from the right and 10 from the bottom, and the reference colour with its tolerance.

    Options

    Border colour
    The default compares every pixel with the top-left pixel, which is the usual white or coloured margin. Choose a colour when the border is a paper shade that the corner pixel does not represent, such as a scan with a printed header.
    Tolerance
    The largest channel difference that still counts as border. Flat digital artwork trims at the default of 8. Check the four edges of the result: raise the number when a soft or uneven margin is left behind, and lower it when pale content near the edge is being absorbed into the border.
    Padding
    Blank space added around the content after the border is removed, measured in pixels. It is held inside the image, so padding larger than the margin gives back the whole picture and the run is refused instead.
    Output format
    Auto keeps the source format. PNG is lossless and suits flat pages, JPEG is smaller for a photograph, and WebP is usually lighter than PNG. The quality setting applies to JPEG and WebP only.

    Supported inputs and limits

    InputOne JPEG, PNG or WebP image
    SizeUp to 64 MiB and 40 megapixels
    OutputA trimmed copy in PNG, JPEG or WebP
    One image per run. This page reads JPEG, PNG and WebP files up to 64 MiB and 40 megapixels, and it needs enough browser memory to hold the pixels while it scans them. A pixel counts as content when it differs from the reference colour by more than the tolerance, so a gradient, a vignette or heavy noise around the picture stops the trim or eats into the edge. Start at the default tolerance of 8, inspect the edges of the result, raise the number only when an uneven margin is still left, and lower it when pale content near the edge is being absorbed into the border. When every pixel already matches the reference colour there is no border to remove, and the run is refused rather than returning the same picture. The crop is cut from the original pixels and encoded again: a PNG result keeps the kept pixels lossless, while a JPEG or WebP result re-encodes the kept area, so those pixels can differ slightly. Embedded metadata is not carried over, and JPEG output fills transparent pixels with white.

    Where your input is processed

    This tool processes your input in this browser. Your text and files are not uploaded to UseFreeTools. Check this tool's limits for anything it may save on your device.

    Why the scan stops at the first differing pixel

    The rectangle grows from the outermost pixel that differs from the border colour, so a single speck of dust in the margin keeps a whole row of empty paper in the result. Cropping that speck away first, or raising the tolerance until a faint speck counts as border, is usually faster than trimming twice.

    Questions about Trim Image Whitespace

    How does the tool decide where the content starts?

    It walks the pixels and keeps the smallest rectangle that holds every pixel differing from the border colour. The margin above, below, left and right is whatever falls outside that rectangle.

    Nothing happened. Why?

    The whole image already matches the reference colour within the tolerance, so there is no border to remove and the run is refused with that message. If the picture has a real border, raise the tolerance or set the border colour yourself.

    Will a slightly uneven grey border still trim?

    Yes, within the tolerance you set. The comparison allows a difference of up to that number in each of the red, green, blue and alpha channels. Start at the default of 8, inspect the edges of the result, and raise it only as far as the margin needs.

    Does trimming change the picture itself?

    The crop removes the outer rows and columns. What happens to the pixels that stay depends on the format: a PNG copy keeps them lossless, while a JPEG or WebP copy is encoded again and the kept area can differ slightly. The file size usually changes, and embedded metadata is not carried over.

    Part of my picture disappeared. Why?

    The tolerance was wide enough for pale content near the edge to count as border. Lower the tolerance and run again, or set the border colour to the exact shade of the margin so the comparison has a narrower target.

    Project manager: Tony Hines · Content updated 4 October 2026 · Report a problem