{"id":15674670,"url":"https://github.com/vfdev-5/imagetilingutils","last_synced_at":"2025-05-06T22:24:56.789Z","repository":{"id":49879103,"uuid":"121234334","full_name":"vfdev-5/ImageTilingUtils","owner":"vfdev-5","description":"Minimalistic set of image reader agnostic tools to easily iterate over large images","archived":false,"fork":false,"pushed_at":"2020-04-07T00:30:42.000Z","size":25854,"stargazers_count":14,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-31T03:32:22.129Z","etag":null,"topics":["image","python3","tile","tiling"],"latest_commit_sha":null,"homepage":"http://imagetilingutils.readthedocs.io/en/latest/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vfdev-5.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-12T10:43:53.000Z","updated_at":"2024-04-12T08:19:25.000Z","dependencies_parsed_at":"2022-09-19T03:40:17.695Z","dependency_job_id":null,"html_url":"https://github.com/vfdev-5/ImageTilingUtils","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vfdev-5%2FImageTilingUtils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vfdev-5%2FImageTilingUtils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vfdev-5%2FImageTilingUtils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vfdev-5%2FImageTilingUtils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vfdev-5","download_url":"https://codeload.github.com/vfdev-5/ImageTilingUtils/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252777813,"owners_count":21802651,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["image","python3","tile","tiling"],"created_at":"2024-10-03T15:49:07.984Z","updated_at":"2025-05-06T22:24:56.739Z","avatar_url":"https://github.com/vfdev-5.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/vfdev-5/ImageTilingUtils.svg?branch=master)](https://travis-ci.org/vfdev-5/ImageTilingUtils)\n[![Coverage Status](https://coveralls.io/repos/github/vfdev-5/ImageTilingUtils/badge.svg?branch=master)](https://coveralls.io/github/vfdev-5/ImageTilingUtils?branch=master)\n[![Documentation Status](https://readthedocs.org/projects/imagetilingutils/badge/?version=latest)](http://imagetilingutils.readthedocs.io/en/latest/?badge=latest)\n\n# Image Tiling Utils\nMinimalistic set of image reader agnostic tools to easily iterate over large images\n\n**Example 1**\n\nLet's iterate over a large image with overlapping tiles of the \nsame size tiles in pixels. At boundaries we add \"no-data\" pixels. \nLet's assume the data access is provided with an example function\n```python\ndef read_data(x, y, width, height, out_width=None, out_height=None):\n    out_width = width if out_width is None else out_width\n    out_height = height if out_height is None else out_height    \n    img.read(x, y, width, height, out_width, out_height)\n``` \nThus, overlapping tiles can be extracted as  \n```python\nfrom tiling import ConstStrideTiles\n\ntiles = ConstStrideTiles(image_size=(500, 500), tile_size=(256, 256), stride=(100, 100), \n                         origin=(-100, -100),\n                         scale=1.0,\n                         include_nodata=True)\n                       \nprint(\"Number of tiles: %i\" % len(tiles))\nfor extent, out_size in tiles:\n    x, y, width, height = extent\n    data = read_data(x, y, width, height, \n                     out_width=out_size[0], \n                     out_height=out_size[1])\n    print(\"data.shape: {}\".format(data.shape))\n    \n# Access a tile:\ni = len(tiles) // 2 \nextent, out_size  = tiles[i]\n```\n\n![example 1 tiles](assets/example_const_stride_tiles.png)\n\n\n**Example 2**\n\nLet's iterate over a large image with overlapping tiles of the same size in pixels. \nIn this case we prefer to not going outside the input image and fill tiles with `nodata`.\nIn this situation, overlapping is not constant. \nLet's assume the data access is provided with an example function\n```python\ndef read_data(x, y, width, height, out_width=None, out_height=None):\n    out_width = width if out_width is None else out_width\n    out_height = height if out_height is None else out_height    \n    img.read(x, y, width, height, out_width, out_height)\n``` \nThus, overlapping tiles can be extracted as  \n```python\nfrom tiling import ConstSizeTiles\n\ntiles = ConstSizeTiles(image_size=(500, 500), tile_size=(256, 256), min_overlapping=15, scale=1.0)\n                       \nprint(\"Number of tiles: %i\" % len(tiles))\nfor extent, out_size in tiles:\n    assert out_size[0] == tiles.tile_size[0]\n    assert out_size[1] == tiles.tile_size[1]\n    x, y, width, height = extent\n    data = read_data(x, y, width, height, \n                     out_width=out_size[0], \n                     out_height=out_size[1])\n    print(\"data.shape: {}\".format(data.shape))\n\n# Access a tile:\ni = len(tiles) // 2 \nextent  = tiles[i]\n```\n\n![example 2 tiles](assets/example_const_size_tiles.png)\n\n\n## Installation:\n\n#### from pip\n```bash\npip install tiling\n```\n\n#### from sources\n\n```bash\npip install git+https://github.com/vfdev-5/ImageTilingUtils.git\n```\n\n## Examples \n\nFor more practical examples, see [notebooks](examples)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvfdev-5%2Fimagetilingutils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvfdev-5%2Fimagetilingutils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvfdev-5%2Fimagetilingutils/lists"}