# 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](https://img.shields.io/pypi/l/pyxlimg)
![PyPI - Implementation](https://img.shields.io/pypi/implementation/pyxlimg)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pyxlimg)
![PyPI - Wheel](https://img.shields.io/pypi/wheel/pyxlimg)
![PyPI - Version](https://img.shields.io/pypi/v/pyxlimg)
## 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.
```sh
pip install pyxlimg
```
## Usage
```py
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.
```py
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](https://pypi.org/project/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.
```bash
poetry install
poetry shell
poetry build
```
How to build sphinx docs.
```bash
sphinx-apidoc -f -o ./docs ./pyxlimg
sphinx-build -b html ./docs ./docs/_build
```
In Windows
```pwsh
pyenv install 3.11.0
pyenv local 3.11.0
poetry install
poetry shell
pytest
poetry build
```
Docker
```bash
docker compose up -d --build
docker compose logs -f
```
Raw data
{
"_id": null,
"home_page": "https://shortarrow.jp",
"name": "pyxlimg",
"maintainer": "ShortArrow",
"docs_url": null,
"requires_python": ">=3.8,<4.0",
"maintainer_email": "bamboogeneral@shortarrow.jp",
"keywords": "xlsx,image,PIL,Pillow,Excel",
"author": "ShortArrow",
"author_email": "bamboogeneral@shortarrow.jp",
"download_url": "https://files.pythonhosted.org/packages/ea/77/16fb094ea7c02117db941193c8ab43cf3a7a1f3368c51e78d9fa6752c42e/pyxlimg-0.1.6.tar.gz",
"platform": null,
"description": "# What is pyxlimg\n\nPyxlimg 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.\n\n![PyPI - License](https://img.shields.io/pypi/l/pyxlimg)\n![PyPI - Implementation](https://img.shields.io/pypi/implementation/pyxlimg)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pyxlimg)\n![PyPI - Wheel](https://img.shields.io/pypi/wheel/pyxlimg)\n![PyPI - Version](https://img.shields.io/pypi/v/pyxlimg)\n\n## Concept\n\nImages 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.\n\n## Install\n\nRecommended to install using pip.\n\n```sh\npip install pyxlimg\n```\n\n## Usage\n\n```py\nfrom PIL import Image\nfrom pyxlimg import xlimg\n\nTestBookName = \"./your-test-data/TestBook.xlsx\"\n\n\nif __name__ == \"__main__\":\n TargetBook: xlimg.ImageBook = xlimg.ImageBook()\n TargetBook.open(TestBookName)\n print(\"This book named '\" + TargetBook.name + \"'.\")\n print(\"This book has \" + len(TargetBook.Sheets) + \" sheets.\")\n print(\"First sheet name is '\" + TargetBook.Sheets[0].displayName + \"'.\")\n print(\"First sheet has \" + len(TargetBook.Sheets[0].Pictures + \" pictures.\")\n TargetBook.Sheets[1].Pictures[0].Image().show() # Show you the Image\n```\n\nIn this way, you can easily assign images to variable.\n\n```py\n DisplayImage: Image = TargetBook.Sheets[1].Pictures[0].Image()\n DisplayImage.show() # Show you the Image too.\n```\n\n## FAQ\n\n### What image format does this support?\n\nIf it is supported by [Pillow](https://pypi.org/project/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.\n\n### What kind of library is this supposed to be used with?\n\nFor example, `Tesseract OCR`, `pylightxl`, `openpyxl`, `matplotlib`. It is also ideal for matching with other `pillow` related libraries.\n\n## Build\n\nHow to build package.\n\n```bash\npoetry install\npoetry shell\npoetry build\n```\n\nHow to build sphinx docs.\n\n```bash\nsphinx-apidoc -f -o ./docs ./pyxlimg\nsphinx-build -b html ./docs ./docs/_build\n```\n\nIn Windows\n\n```pwsh\npyenv install 3.11.0\npyenv local 3.11.0\npoetry install\npoetry shell\npytest\npoetry build\n```\n\nDocker\n\n```bash\ndocker compose up -d --build\ndocker compose logs -f\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Image Extractor for XLSX files",
"version": "0.1.6",
"project_urls": {
"Documentation": "https://pyxlimg.readthedocs.io/en/latest/pyxlimg.html",
"Homepage": "https://shortarrow.jp",
"Repository": "https://github.com/shortarrow/pyxlimg"
},
"split_keywords": [
"xlsx",
"image",
"pil",
"pillow",
"excel"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6e819b904e5c79f576f3551825ebb65d373a1d587e5af6d5a8ec402c482248b9",
"md5": "cee0551bc2f492b20de0ec8884e265a5",
"sha256": "d6d6d5faf5b86db9eefe5b38061d7e4dea8133590959d9b415e82bf61410b90a"
},
"downloads": -1,
"filename": "pyxlimg-0.1.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "cee0551bc2f492b20de0ec8884e265a5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<4.0",
"size": 4733,
"upload_time": "2024-01-05T18:19:52",
"upload_time_iso_8601": "2024-01-05T18:19:52.035500Z",
"url": "https://files.pythonhosted.org/packages/6e/81/9b904e5c79f576f3551825ebb65d373a1d587e5af6d5a8ec402c482248b9/pyxlimg-0.1.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ea7716fb094ea7c02117db941193c8ab43cf3a7a1f3368c51e78d9fa6752c42e",
"md5": "8b6124e12e0c18a08dd60b2c4d59d559",
"sha256": "148e9a7b1a4c6d8b1248af7ceeb233dd06a2c1c37c9879ce44571a7225d0404e"
},
"downloads": -1,
"filename": "pyxlimg-0.1.6.tar.gz",
"has_sig": false,
"md5_digest": "8b6124e12e0c18a08dd60b2c4d59d559",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8,<4.0",
"size": 4529,
"upload_time": "2024-01-05T18:19:53",
"upload_time_iso_8601": "2024-01-05T18:19:53.167361Z",
"url": "https://files.pythonhosted.org/packages/ea/77/16fb094ea7c02117db941193c8ab43cf3a7a1f3368c51e78d9fa6752c42e/pyxlimg-0.1.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-05 18:19:53",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "shortarrow",
"github_project": "pyxlimg",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pyxlimg"
}