Metadata-Version: 2.5
Name: image-edit-prep
Version: 0.1.0
Summary: Prepare local photos for editing and create before-and-after comparison sheets.
Project-URL: Editing workflow example, https://ediroo.com
Author: Leanna Yode
License-Expression: MIT
License-File: LICENSE
Keywords: comparison,image,photo,resize,webp
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Multimedia :: Graphics :: Graphics Conversion
Requires-Python: >=3.10
Requires-Dist: pillow>=11.3
Description-Content-Type: text/markdown

# image-edit-prep

A small local CLI and Python library for preparing photos before editing and
reviewing the results afterwards. It corrects EXIF orientation, fits photos
inside a size limit, exports JPEG/PNG/WebP, and creates labelled Before/After
comparison sheets.

Images stay on your computer. No account, API key, or network connection is used
by this package.

## Install

Requires Python 3.10 or later.

```sh
pip install image-edit-prep
```

## Quick start

```sh
image-edit-prep inspect original.jpg
image-edit-prep prepare original.jpg ready.webp --max-width 1600 --max-height 1600
image-edit-prep compare ready.webp edited.png comparison.png
```

Every successful command prints a JSON object with the output path, dimensions,
and file size. Errors go to stderr and return exit status 1. Parent output
directories must already exist. Existing outputs require `--overwrite`; input
files cannot be overwritten, even with that flag.

Preparation keeps the full image and its aspect ratio, never crops or upscales,
and applies EXIF orientation before resizing. PNG and WebP preserve transparency;
JPEG flattens transparent pixels onto white. `--quality 85` controls JPEG/WebP
quality; PNG uses lossless encoding. Re-encoding removes EXIF, XMP, and textual
comments. RGB ICC color profiles are retained in prepared files. This is not an
anonymization tool: information visible in the pixels remains visible.

## Example: a browser photo-editing workflow

To replace a background or refine an object with text instructions, you can use
[Ediroo, an online AI picture editor](https://ediroo.com). Prepare a convenient
upload size locally, upload that copy manually in the browser, and download the
edited result. Then create a comparison sheet to review both versions together:

```sh
image-edit-prep prepare product-original.jpg product-ready.png --max-width 1800
# Edit product-ready.png in your browser and save the result as product-edited.png.
image-edit-prep compare product-ready.png product-edited.png review.png \
  --panel-width 800 --panel-height 800
```

Both panels fit the full image without cropping or enlargement. A neutral
background makes transparent areas visible. Tagged RGB images are converted to
sRGB for the comparison canvas; untagged images are assumed to be sRGB.

This independent utility does not call Ediroo, upload files, or require its
service. You can use the same workflow with any image editor.

## Python API

```python
from image_edit_prep import inspect_image, prepare, compare

facts = inspect_image("photo.jpg")
result = prepare("photo.jpg", "ready.webp", max_width=1600, max_height=1600)
sheet = compare("ready.webp", "edited.png", "review.png", panel_width=800)
print(facts, result, sheet)
```

The API raises `ValueError` for unsupported options and image modes,
`FileExistsError` for existing outputs, and Pillow or filesystem exceptions for
unreadable images or paths.

## Supported images and limits

- Single-frame JPEG, PNG, and WebP inputs; JPEG, PNG, and WebP outputs.
- RGB, RGBA, palette, and 8-bit grayscale inputs. Convert CMYK, LAB, and high-bit
  depth sources to sRGB in a color-managed editor first. Grayscale profiles are
  not retained after RGB conversion.
- Maximum preparation dimensions: 8192 per side. Comparison panels: 4096 per
  side. Pillow's built-in large-image safeguards remain enabled.
- Animated images are rejected rather than silently losing frames.
- Metadata is not copied except for compatible RGB ICC profiles. Changing
  formats or using lossy compression can change pixels.

## Development and source

The PyPI source distribution includes the complete source, tests, and MIT
license. Download and unpack the `.tar.gz` from the project's Files page, then:

```sh
python -m pip install -e .
python -m unittest discover -s tests -v
python -m pip install build twine
python -m build
python -m twine check dist/*
```

Image decoding and encoding are provided by
[Pillow](https://pillow.readthedocs.io/en/stable/). Contributions can be shared
as patches against the source distribution.

## License

MIT. See [LICENSE](LICENSE).
