Metadata-Version: 2.4
Name: make-image-square
Version: 1.0.0
Summary: Compute square canvas size and padding so an image fits 1:1 without cropping.
Author: squareimage.run
License-Expression: MIT
Project-URL: Homepage, https://squareimage.run
Keywords: square,image,padding,1:1,aspect-ratio,fit,resize
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Multimedia :: Graphics
Classifier: Typing :: Typed
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# make-image-square

Tiny helper that turns any image size into a **1:1 layout plan**: square canvas size plus left/right/top/bottom padding so you can fit without cropping.

Useful when you need the math for letterboxing / pillarboxing before you draw to a canvas, generate CSS `object-fit`-style boxes, or prep assets for Instagram and profile photos.

## Install

```bash
pip install make-image-square
```

## Usage

```python
from make_image_square import make_image_square, square_padding

# 1200×800 landscape → 1200×1200 with side pads
layout = make_image_square(1200, 800)
# {
#   "canvas": 1200,
#   "contentWidth": 1200,
#   "contentHeight": 800,
#   "padLeft": 0, "padRight": 0, "padTop": 200, "padBottom": 200,
#   ...
# }

# Force a specific square edge (e.g. 1080 for feed posts)
ig = make_image_square(1200, 800, canvas_size=1080, mode="fit")

# Padding-only helper
pads = square_padding(800, 1200)  # portrait → pad left/right
```

### Modes

| Mode | Behavior |
|------|----------|
| `fit` (default) | Entire image visible; empty bands become padding |
| `fill` | Image covers the square; caller is expected to crop overflow |

## Notes

- This package only returns numbers. It does not decode or rewrite image files.
- For a browser UI that pads, blurs the frame, crops, or resizes to square in one pass, there is a free online tool at [squareimage.run](https://squareimage.run) if you prefer not to wire up canvas yourself.

## License

MIT
