How the GIMP Measure Tool Straightens and Crops

The Measure tool in GIMP offers an automated "Straighten" feature designed to fix tilted horizons and crooked photos in a single click. When activated, GIMP calculates the precise angle of a user-drawn measurement line, rotates the image to level that line, and optionally trims away the resulting transparent corners through integrated clipping settings.

How the Straighten Function Works

To use the feature, select the Measure Tool (keyboard shortcut Shift + M) and click-and-drag a line across a reference point that should be level, such as a horizon, a tabletop, or a structural line. As you drag, GIMP calculates the angle of this line relative to the horizontal axis.

When you click the Straighten button in the Measure Tool Options dock, GIMP executes the following actions:

  1. Angle Detection and Inverse Rotation: GIMP reads the angle of your drawn line. It then applies a rotation transformation in the opposite direction by that exact number of degrees. If your line is closer to vertical, holding the Shift key while clicking "Straighten" will align the line vertically instead of horizontally.
  2. Transform Target Application: By default, the transformation is applied to the active layer, but depending on the "Transform" setting in the tool options, it can rotate the entire image, a selection, or a path.

How the Canvas is Cropped

The rotation inevitably creates tilted edges, leaving empty, transparent areas around the borders of the rectangular canvas. The Measure tool handles the cropping of these edges automatically based on the Clipping dropdown menu located directly below the Straighten button:

  • Adjust: The canvas expands to fit the entire rotated image. No cropping occurs, leaving triangular transparent wedges at the corners.
  • Clip: The original canvas dimensions are preserved, cutting off any corners of the image that rotate outside the original boundary while leaving transparent areas inside the frame.
  • Crop to result: GIMP automatically calculates and applies the largest possible inner rectangle that contains only image pixels. It trims away all exterior transparent edges, producing a cleanly framed, straightened image without requiring a separate crop step.
  • Crop with aspect: GIMP performs the same automatic crop as "Crop to result," but restricts the crop boundaries to preserve the image’s original width-to-height aspect ratio.