Skip to content

Get the format right

Giacomo Marchioro edited this page Jul 21, 2021 · 1 revision

pyIIIFpres checks the format MIME type based on IANA media types page, building the missing templates from the registry and the format for instance image/jpeg,image/gif etc. etc.

The full list of media types used by pyIIIFpres can be accessed using:

from IIIFpres import iiifpapi3
iiifpapi3.MEDIATYPES

An additional helper class gives you the possibility to access the mediatypes using the dot notation:

from IIIFpres import MediaTypes                                         
In [1]: MediaTypes.audio.mp4                                                    
Out[1]: 'audio/mp4'

In [2]: MediaTypes.image.jp2                                                   
Out[2]: 'image/jp2'

In [3]: MediaTypes.application.json_seq                                        
Out[3]: 'application/json-seq'