Skip to main content

Image Extractor for XLSX files

Project description

What is pyxlimg

Pyxlimg is for extracting images from xlsx. It has a high affinity with other libraries. This is because you can treat the image as an instance of Pillow.Image.

Concept

Images are difficult to handle with xlwings, openpyxl, and pylightxl. Especially linter and type annotation are difficult. Complement these. And the goal is to make it easier to do OCR etc. using xlsx in Python.

Install

Recommended to install using pip.

pip install pyxlimg

Usage

from PIL import Image
from pyxlimg import xlimg

TestBookName = "./your-test-data/TestBook.xlsx"


if __name__ == "__main__":
    TargetBook: xlimg.ImageBook = xlimg.ImageBook()
    TargetBook.open(TestBookName)
    print("This book named '" + TargetBook.name + "'.")
    print("This book has " + len(TargetBook.Sheets) + " sheets.")
    print("First sheet name is '" + TargetBook.Sheets[0].displayName + "'.")
    print("First sheet has " + len(TargetBook.Sheets[0].Pictures + " pictures.")
    TargetBook.Sheets[1].Pictures[0].Image().show() # Show you the Image

In this way, you can easily assign images to variable.

    DisplayImage: Image = TargetBook.Sheets[1].Pictures[0].Image()
    DisplayImage.show() # Show you the Image too.

FAQ

What image format does this support?

If it is supported by Pillow, it can be supported. If the original image is in a commonly used format such as png, jpg, bmp when pasted or inserted into xlsx.

What kind of library is this supposed to be used with?

For example, Tesseract OCR, pylightxl, openpyxl, matplotlib. It is also ideal for matching with other pillow related libraries.

Build

How to build package.

poetry install
poetry shell
poetry build

How to build sphinx docs.

poetry export --with dev -f requirements.txt > requirements.txt
sphinx-apidoc -f -o ./docs ./pyxlimg
sphinx-build -b html ./docs ./docs/_build

In Windows

pyenv install 3.11.0
pyenv local 3.11.0
poetry install
poetry shell
pytest
poetry build

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

pyxlimg-0.1.3.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

pyxlimg-0.1.3-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file pyxlimg-0.1.3.tar.gz.

File metadata

  • Download URL: pyxlimg-0.1.3.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.6 Windows/10

File hashes

Hashes for pyxlimg-0.1.3.tar.gz
Algorithm Hash digest
SHA256 8c78dbac2878fd24476e460d1d086a9e25ce3ad70a03bb6722dd1b3ac9912b6a
MD5 56422a64227430f613a3c40a03d50c33
BLAKE2b-256 fd0aa730ec60ed38add3446e54de1b4b64d154c9cc284986f6454955f2bb493e

See more details on using hashes here.

Provenance

File details

Details for the file pyxlimg-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: pyxlimg-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.11.6 Windows/10

File hashes

Hashes for pyxlimg-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d71dd29e9e7297f9c528e47d941f42f899a7eb099f4186b7c02550653ca5f148
MD5 ca840f80050ad50101b8ffd725387216
BLAKE2b-256 d6b2fc138907bf39e426bf3640c80043bf7ce0f48b6b33129246d434ab8f2071

See more details on using hashes here.

Provenance

Supported by

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