Metadata-Version: 2.4
Name: reference-image-pixel-regions
Version: 0.1.0
Summary: Convert normalized reference-image selections to enclosing pixel regions.
Author: js-upup
License-Expression: MIT
Project-URL: Reference image workspace, https://aih3image.com/minimax-h3-image-to-image
Keywords: reference-image,annotations,pixel-coordinates
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# Reference Image Pixel Regions

Convert normalized annotations into the smallest integer pixel rectangle that
fully contains the selection. This is useful when an annotation arrives as
fractions of the image width and height and a cropper expects pixel coordinates.

## Usage

```bash
pip install reference-image-pixel-regions
```

```python
from reference_image_pixel_regions import enclosing_pixels

region = enclosing_pixels(1200, 800, "0.25", "0.10", "0.75", "0.50")
# PixelRegion(left=300, top=80, right=900, bottom=400)
```

The origin is the top left. Right and bottom are exclusive. Supply coordinates
in the range 0 to 1. Decimal strings preserve the intended boundary. The
library works with dimensions and coordinates and leaves image I/O and editing
to the caller. It requires Python 3.9 or newer and uses the standard library.

For the related online editing workflow, see the
[AI H3 Image reference-image workspace](https://aih3image.com/minimax-h3-image-to-image).

MIT license.
