﻿# Convert Label Studio rectangles without confusing percentages and pixels

Convert Label Studio image rectangles into pixel coordinates while preserving the original canvas, rotation and label mapping used by a detector dataset.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-label-studio-rectangle-percent-pixels/
Language: en

## Recognize the coordinate system

A rectangle that looks correct in an annotation interface can become a tiny box in a training preview. Label Studio stores rectangle location and size as percentages of the original image dimensions. The [RectangleLabels reference](https://labelstud.io/tags/rectanglelabels) describes the corresponding original dimensions and separate rotation fields. Treating those stored values as pixels changes the annotation geometry even when the export parses successfully.

## Convert against the annotated image

For an unrotated image and rectangle, multiply each horizontal percentage by the original width divided by 100, and each vertical percentage by the original height divided by 100. As an illustrative example, a horizontal position of 25 on an image 800 pixels wide becomes 200 pixels. Apply the width rule to rectangle width as well. Using the displayed browser size or a resized training tensor silently introduces a different canvas.

## Keep rotation as a separate transformation

The rectangle's rotation and the image's rotation describe different transformations. A conversion that simply multiplies coordinates cannot generally preserve a rotated rectangle as an equivalent axis-aligned box. Decide whether the target detector accepts oriented boxes, transformed corners or an enclosing axis-aligned rectangle. The last option changes the represented area. Compare an overlay on the exact input image before interpreting the converted labels as ground truth.

## Export to the detector's actual convention

The [export guide](https://labelstud.io/guide/export) lists multiple detector formats. Some expect corner coordinates; others use a normalized center and dimensions. Confirm the chosen format's convention and class mapping, including category ordering, instead of applying an extra normalization step to an already normalized output. Keep the annotation configuration alongside the exported dataset so label names and class identifiers can be reconstructed later.

## Verify geometry rather than file readability

Start with a submitted example from the [labeling workflow](https://labelstud.io/guide/labeling), then compare its original overlay with the converted overlay. Include a border-touching box, a narrow region and an oriented example. Inspect class identity and bounds independently. This targeted geometry check complements [EXIF orientation handling](/journal/data-guide-image-exif-box-coordinate/) and [COCO annotation identity](/journal/data-guide-coco-instance-caption-identities/); a valid JSON file alone cannot establish that the detector will see the intended objects.
