How GIMP Guillotine Slices Images Using Guides
The Guillotine command in the GNU Image Manipulation Program (GIMP) is a slicing utility that automatically divides a single canvas into multiple independent image files based on intersecting guide lines. By reading the precise coordinates of every horizontal and vertical guide placed on the canvas, the command maps out a grid of sub-rectangles and instantly exports each bounded region into its own separate, unsaved document window.
The Mechanics of Guide Intersections
Guides in GIMP are non-printing, infinite vector lines snapped to specific pixel coordinates along the X (horizontal) and Y (vertical) axes. When you place one or more horizontal guides and one or more vertical guides on an image, they cross each other at perpendicular angles, defining a two-dimensional grid across the canvas.
The outer canvas edges serve as the default perimeter boundaries (top, bottom, left, and right). Each guide added to the canvas introduces an internal cut line. If you have \(H\) horizontal guides and \(V\) vertical guides, the resulting intersecting planes create a total of \((H + 1) \times (V + 1)\) rectangular zones.
How Guillotine Processes the Grid
When you navigate to Image > Guillotine, the software executes the following sequence:
- Coordinate Detection: GIMP scans the image metadata for active guides, sorting horizontal positions by their Y-coordinates and vertical positions by their X-coordinates.
- Boundary Definition: Using the canvas boundaries \((0,0)\) to \((\text{width}, \text{height})\) alongside the sorted guide coordinates, the system calculates the exact bounding box \((\text{X}_1, \text{Y}_1, \text{X}_2, \text{Y}_2)\) for every enclosed section.
- Buffer Duplication: For each bounding box, GIMP copies the pixel data within those coordinates across all visible layers or merges down the data depending on the image state.
- Document Instantiation: A brand-new image document is initialized for every individual section with dimensions matching that specific sub-rectangle's width and height.
- Display and Memory Allocation: Each sliced segment appears as an independent tab or window in the workspace, labeled sequentially (e.g., "Untitled").
Operational Requirements and Behavior
- Requires Guides: If you run the Guillotine command on an image with no guides present, the operation will fail or do nothing, as it requires at least one guide to create a dividing plane. A single guide will split the canvas into two separate documents.
- Full-Width Slicing: Because guides span the entire width or height of the canvas, Guillotine always slices completely through the image. It cannot perform partial, non-continuous cuts; every slice follows the continuous grid created by the intersecting guide planes.
- Non-Destructive Execution: The original image remains completely intact and unaltered. The Guillotine operation generates entirely new documents in system memory, leaving the source project open with its guides preserved. Once sliced, each resulting document must be saved or exported individually to your desired file format.