Skip to main content

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

Project description

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)
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

otary-0.4.0.tar.gz (90.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

otary-0.4.0-py3-none-any.whl (126.8 kB view details)

Uploaded Python 3

File details

Details for the file otary-0.4.0.tar.gz.

File metadata

  • Download URL: otary-0.4.0.tar.gz
  • Upload date:
  • Size: 90.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.13.1 Linux/6.11.0-1018-azure

File hashes

Hashes for otary-0.4.0.tar.gz
Algorithm Hash digest
SHA256 666dda23ff83a360f6f9aba568a9ffb4aa78aefd114e987b7a21d3e0e809f314
MD5 e77562ed2e9c269ab0536f689f6238e5
BLAKE2b-256 56d3c1d559411b0f59706a49367fc33e55e22f7bd5dcd4e952d98d243850fc37

See more details on using hashes here.

File details

Details for the file otary-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: otary-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 126.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.13.1 Linux/6.11.0-1018-azure

File hashes

Hashes for otary-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1a177b5f2f55bf9447255f1c33d7482db02d32e6931e1ca89b351ec3c2e82364
MD5 99b319c0ffa9d0ee1f84836610f2ae86
BLAKE2b-256 52045fe9fc590ec80f5d6a57f636be760a23ce29be686fe998dc5edd32687206

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page