IIIFManifestLoader
loader.graphical.IIIFManifestLoader()
Load image metadata from IIIF Presentation API manifests.
IIIF manifests contain canvas dimensions that represent image sizes. This loader extracts width/height for use with graphical timelines without needing to download or load the actual image files.
Supports both IIIF Presentation API 2.x and 3.x formats.
Examples
>>> loader = IIIFManifestLoader()
>>> loader.load("manifest.json" )
>>> loader.dimensions
{'width' : 4096 , 'height' : 299400 }
>>> # Access individual canvases
>>> for canvas in loader.manifest_info.canvases:
... print (f" { canvas. label} : { canvas. width} x { canvas. height} " )
Attributes
manifest_info
IIIFManifestInfo
Parsed manifest information (after loading).
Methods
create_timeline
loader.graphical.IIIFManifestLoader.create_timeline(
uid= None ,
name= None ,
axis= 'height' ,
)
Create a graphical timeline from the loaded IIIF manifest.
The timeline length is determined by the image dimensions along the specified axis (height by default, for vertical piano rolls).
Parameters
uid
str | None
Unique identifier for the timeline. Auto-generated if None.
None
name
str | None
Human-readable name. Uses manifest/canvas label if None.
None
axis
str
Which dimension to use as the timeline axis: - “height” (default): Timeline length = image height - “width”: Timeline length = image width
'height'
Returns
'Timeline'
A DiscreteGraphicalTimeline representing the image.
Raises
RuntimeError
If no manifest has been loaded.
ValueError
If axis is not “height” or “width”.
Examples
>>> loader = IIIFManifestLoader()
>>> loader.load("manifest.json" )
>>> timeline = loader.create_timeline(uid= "dgt1_image" )
get_canvas
loader.graphical.IIIFManifestLoader.get_canvas(index= 0 )
Get canvas information by index.
Parameters
index
int
Zero-based canvas index.
0
Returns
IIIFCanvasInfo
IIIFCanvasInfo for the requested canvas.
Raises
IndexError
If index is out of range.