Skip to main content

orient

Detect and fix image orientation using a deep learning model (Deep-OAD ViT).

Install

pip install orient

Usage

import orient

# Detect orientation
result = orient.detect("photo.jpg")
result.orientation      # orient.Orientation.CW_90
result.confidence       # 0.93
result.angle            # 82.4
result.needs_rotation   # True
result.is_correct       # False

# Batch detection
results = orient.detect(["a.jpg", "b.jpg"])

# Folder detection — finds all JPEGs recursively
results = orient.detect("photos/")
for r in results:
    print(f"{r.path.name}: {r.orientation.label}")

# Folder options
orient.detect("photos/", batch_size=16, recursive=False)

# PIL Image input
from PIL import Image
result = orient.detect(Image.open("photo.jpg"))

# Detect + fix orientation
orient.fix("photo.jpg")                       # set EXIF tag (default, lossless)
orient.fix("photo.jpg", method="transpose")   # rotate pixels via Pillow
orient.fix(["a.jpg", "b.jpg"])

# Fix an entire folder
orient.fix("photos/")

How it works

Uses a fine-tuned ViT model to predict the rotation angle of an image. For 90/270 degree predictions, a verification pass rotates the image both ways and picks the direction that looks most upright.

Model weights (~990 MB) are automatically downloaded from Hugging Face on first use.

Rotation methods

  • exif (default) — Sets the EXIF Orientation tag via piexif. Truly lossless (metadata only). No external tools needed.
  • transpose — Rotates pixels using Pillow. Re-encodes JPEG but works everywhere. No external tools needed.

See also

  • auto-orient - CLI tool for bulk processing
  • Deep-OAD - The underlying orientation angle detection model

Metadata

Release files for orient-img 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for orient-img 0.2.0
File Size Uploaded
orient_img-0.2.0.tar.gz 5.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for orient-img 0.2.0
File Interpreter ABI Platform
orient_img-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.6 kB

Release files / orient_img-0.2.0.tar.gz

Download URL orient_img-0.2.0.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
46a11b5435b0e721b53efbb1f80023a265d8aefd34dd5b4e925751d7f62498e1
BLAKE2b-256 checksum
How to use checksums
15d2103d0275e9070501ffd9c42b5a6d11ea29372c1697ef865f8e1f44d1ea84
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 2, 2026.

Transparency log

Release files / orient_img-0.2.0-py3-none-any.whl

Download URL orient_img-0.2.0-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ccdef866ffb6d191156d6902ec073ae635498be62ea969ed061ddfa7e3aabefe
BLAKE2b-256 checksum
How to use checksums
8695d042d9ddfa7be28424efb5dd322baab6f4172abccefb83e9d2ea40a66f8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 2, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page