# Line image extractor
This is a tool and a library to be used for extracting line images. Built by [Teklia](https://teklia.com) and freely available as open-source under the MIT licence.
It supports different extraction methods:
* boundingRect - bounding rectangle of the line polygon
* polygon - exact polygon
* min_area_rect - minimum area rectangle containing the polygon
* deskew_polygon - deskew the polygon
* deskew_min_area_rect - deskew the minimum area rectangle
* skew_polygon - skew the polygon (rotate by some angle)
* skew_min_area_rect - skew the minimum area rectangle (rotate by some angle)
Install the library using stable version from Pypi:
```bash
pip install teklia-line-image-extractor
```
Install the library in development mode:
```bash
pip install -e .
```
Test extraction:
```bash
line-image-extractor -i tests/data/page_img.jpg -o out.jpg -p tests/data/line_polygon.json -e deskew_min_area_rect --color
```
How to use it?:
```python
from pathlib import Path
import numpy as np
from line_image_extractor.extractor import extract, read_img, save_img
from line_image_extractor.image_utils import polygon_to_bbox
from line_image_extractor.image_utils import Extraction
page_img = read_img(Path("tests/data/page_img.jpg"))
polygon = np.asarray([[241, 1169], [2287, 1251], [2252, 1190], [244, 1091], [241, 1169]])
bbox = polygon_to_bbox(polygon)
extracted_img = extract(
page_img, polygon, bbox, Extraction.polygon
)
save_img("line_output.jpg", extracted_img)
```
Raw data
{
"_id": null,
"home_page": "https://gitlab.teklia.com/atr/line_image_extractor",
"name": "teklia-line-image-extractor",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "line transformation image extraction",
"author": "Martin Maarand",
"author_email": "maarand@teklia.com",
"download_url": "https://files.pythonhosted.org/packages/a6/6c/563aba69b3ed965a2081598b50bb349c49278bfccd01be3da49d4a3dd1c2/teklia_line_image_extractor-0.7.0.tar.gz",
"platform": null,
"description": "# Line image extractor\n\nThis is a tool and a library to be used for extracting line images. Built by [Teklia](https://teklia.com) and freely available as open-source under the MIT licence.\n\nIt supports different extraction methods:\n* boundingRect - bounding rectangle of the line polygon\n* polygon - exact polygon\n* min_area_rect - minimum area rectangle containing the polygon\n* deskew_polygon - deskew the polygon\n* deskew_min_area_rect - deskew the minimum area rectangle\n* skew_polygon - skew the polygon (rotate by some angle)\n* skew_min_area_rect - skew the minimum area rectangle (rotate by some angle)\n\nInstall the library using stable version from Pypi:\n\n```bash\npip install teklia-line-image-extractor\n```\n\nInstall the library in development mode:\n\n```bash\npip install -e .\n```\n\nTest extraction:\n\n```bash\nline-image-extractor -i tests/data/page_img.jpg -o out.jpg -p tests/data/line_polygon.json -e deskew_min_area_rect --color\n```\n\nHow to use it?:\n\n```python\nfrom pathlib import Path\nimport numpy as np\nfrom line_image_extractor.extractor import extract, read_img, save_img\nfrom line_image_extractor.image_utils import polygon_to_bbox\nfrom line_image_extractor.image_utils import Extraction\n\npage_img = read_img(Path(\"tests/data/page_img.jpg\"))\npolygon = np.asarray([[241, 1169], [2287, 1251], [2252, 1190], [244, 1091], [241, 1169]])\nbbox = polygon_to_bbox(polygon)\nextracted_img = extract(\n page_img, polygon, bbox, Extraction.polygon\n)\nsave_img(\"line_output.jpg\", extracted_img)\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "A tool for extracting a text line image from the contour with different methods",
"version": "0.7.0",
"project_urls": {
"Homepage": "https://gitlab.teklia.com/atr/line_image_extractor"
},
"split_keywords": [
"line",
"transformation",
"image",
"extraction"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "172662d5585267ae476f98ec9179bbfdcd82fbbe1f9ad458e748eaa385c9cc89",
"md5": "b7af35cf3911e1764369032e7bb967ce",
"sha256": "238e55332c7c9ff0a6fec3b244573f7b57cf5ac77738f598a7c07a9a1089408d"
},
"downloads": -1,
"filename": "teklia_line_image_extractor-0.7.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b7af35cf3911e1764369032e7bb967ce",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 8954,
"upload_time": "2025-07-10T08:32:41",
"upload_time_iso_8601": "2025-07-10T08:32:41.454737Z",
"url": "https://files.pythonhosted.org/packages/17/26/62d5585267ae476f98ec9179bbfdcd82fbbe1f9ad458e748eaa385c9cc89/teklia_line_image_extractor-0.7.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "a66c563aba69b3ed965a2081598b50bb349c49278bfccd01be3da49d4a3dd1c2",
"md5": "11c6681f77bf90d4e6749c4cf92f4499",
"sha256": "6d40f09ef1a5acd97803dcb87d6b5e8082058f51f597839a23370907956ce5ec"
},
"downloads": -1,
"filename": "teklia_line_image_extractor-0.7.0.tar.gz",
"has_sig": false,
"md5_digest": "11c6681f77bf90d4e6749c4cf92f4499",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 10009,
"upload_time": "2025-07-10T08:32:42",
"upload_time_iso_8601": "2025-07-10T08:32:42.758957Z",
"url": "https://files.pythonhosted.org/packages/a6/6c/563aba69b3ed965a2081598b50bb349c49278bfccd01be3da49d4a3dd1c2/teklia_line_image_extractor-0.7.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-10 08:32:42",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "teklia-line-image-extractor"
}