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.

PyPI - License PyPI - Implementation PyPI - Python Version PyPI - Wheel PyPI - Version

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.

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

Docker

docker compose up -d --build
docker compose logs -f

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.6.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

pyxlimg-0.1.6-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyxlimg-0.1.6.tar.gz
  • Upload date:
  • Size: 4.5 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.6.tar.gz
Algorithm Hash digest
SHA256 148e9a7b1a4c6d8b1248af7ceeb233dd06a2c1c37c9879ce44571a7225d0404e
MD5 8b6124e12e0c18a08dd60b2c4d59d559
BLAKE2b-256 ea7716fb094ea7c02117db941193c8ab43cf3a7a1f3368c51e78d9fa6752c42e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyxlimg-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 4.7 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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 d6d6d5faf5b86db9eefe5b38061d7e4dea8133590959d9b415e82bf61410b90a
MD5 cee0551bc2f492b20de0ec8884e265a5
BLAKE2b-256 6e819b904e5c79f576f3551825ebb65d373a1d587e5af6d5a8ec402c482248b9

See more details on using hashes here.

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