Skip to main content

Otary

Otary library, shape your images, image your shapes.

Package version License License Code style: black

Welcome to Otary

Otary — elegant, readable, and powerful image and 2D geometry Python library.

Features

The main features of Otary are:

  • Unification: Otary offers a cohesive solution for image and geometry manipulation, letting you work seamlessly without switching tools.

  • Readability: Self-explanatory by design. Otary’s clean, readable code eliminates the need for comments, making it easy for beginners to learn and for experts to build efficiently.

  • Performance: optimized for speed and efficiency, making it suitable for high-performance applications. It is built on top of NumPy and OpenCV, which are known for their speed and performance.

  • Interactivity: designed to be Interactive and user-friendly, ideal for Jupyter notebooks and live exploration.

  • Flexibility: provides a flexible and extensible architecture, allowing developers to customize and extend its functionality as needed.

Installation

Otary is available on PyPI. You can install it with:

pip install otary

Example

Let me illustrate the usage of Otary with a simple example. Imagine you need to:

  1. read an image from a pdf file
  2. draw an rectangle on it, shift and rotate the rectangle
  3. crop a part of the image
  4. rotate the cropped image
  5. apply a threshold
  6. show the image

In order to compare the use of Otary versus other libraries, I will use the same example but with different libraries. Try it yourself on your favorite LLM (like ChatGPT) by copying the query:

Generate a python code to read an image from a pdf, draw a rectangle on it, shift and rotate the rectangle, crop a part of the image, rotate the cropped image, apply a threshold on the image.

Using Otary you can do it with few lines of code:

import otary as ot

im = ot.Image.from_pdf("path/to/you/file.pdf", page_nb=0)

rectangle = ot.Rectangle([[1, 1], [4, 1], [4, 4], [1, 4]]) * 100
rectangle.shift([50, 50]).rotate(angle=30, is_degree=True)

im = (
    im.draw_polygons([rectangle])
    .crop(x0=50, y0=50, x1=450, y1=450)
    .rotate(angle=90, is_degree=True)
    .threshold_simple(thresh=200)
)

im.show()

Using Otary makes the code:

  • Much more readable and hence maintainable
  • Much more interactive
  • Much simpler, simplifying libraries management by only using one library and not manipulating multiple libraries like Pillow, OpenCV, Scikit-Image, PyMuPDF etc.

Enhanced Interactivity

In a Jupyter notebook, you can easily test and iterate on transformations by simply commenting part of the code as you need it.

im = (
    im.draw_polygons([rectangle])
    # .crop(x0=50, y0=50, x1=450, y1=450)
    # .rotate(angle=90, is_degree=True)
    .threshold_simple(thresh=200)
)

Metadata

Release files for otary 0.5.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 otary 0.5.0
File Size Uploaded
otary-0.5.0.tar.gz 101.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for otary 0.5.0
File Interpreter ABI Platform
otary-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 240.6 kB

Release files / otary-0.5.0.tar.gz

Download URL otary-0.5.0.tar.gz
Size 101.2 kB
Tags Source
SHA-256 checksum
How to use checksums
29098f290be65b6fc080756215dcd50c89f00a56cb5ad6efbbf13c77a9317091
BLAKE2b-256 checksum
How to use checksums
0f1ab4b75c4116a8e0936f24f92b571cea5da383ae357f703d89a43cde3de9b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.13.1 Linux/6.17.0-1018-azure

Release files / otary-0.5.0-py3-none-any.whl

Download URL otary-0.5.0-py3-none-any.whl
Size 139.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
98c208f5a3f0ef3cdb9c976f093535af2e8ff92a682dca29353ee7614da711e0
BLAKE2b-256 checksum
How to use checksums
f506794da59a523ed359f018554d675f8c7756a05515d321471b7dc5af9b499d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.13.1 Linux/6.17.0-1018-azure

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.0

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