Skip to content

rust future panicked: unknown error when TIFF contains strips rather than tiles #98

@maxrjones

Description

@maxrjones

TIFF.fetch_tile() panics if the TIFF contains strips defined by IFD.rows_per_strip rather than tiles defined by IFD.tile_width, IFD.tile_height, etc.

MVCE:

import obstore as obs
from async_tiff import TIFF
from async_tiff.store import LocalStore
import os
import asyncio


# Set which file to run the test on
file = "int8.tif"
# Download file
store = obs.store.HTTPStore.from_url("https://dagshub.com")

path = f"maxrjones/virtual-tiff/raw/73934fbfb31cd5bb099f225a47ac8ea34298f3ea/tests/dvc/gdal_autotest/{file}"

resp = obs.get(store, path)
with open(file, "wb") as f:
    for chunk in resp:
        f.write(chunk)

async def load_tile(*, store, path):
    tiff = await TIFF.open(path, store=store)
    return await tiff.fetch_tile(0, 0, 0)

store = LocalStore()
filepath = f"{os.getcwd()}/{file}"

tile = asyncio.run(load_tile(store=store, path=filepath))
print(tile)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions