0

我正在努力从我的 .Net Web 应用程序中显示 Universal Viewer。我有许多 JP2 图像存储在 IIP 图像服务器中。现在,我想创建 manifest.json 来提供我的 Universal Viewer。是否可以使用画布为存储在图像服务器中的所有图像动态创建它。请帮我。

谢谢

4

2 回答 2

0

对于 IIIF 演示 API 2.0 和更早版本,有一个用于 Python iiif-prezi 的出色工具,它是一个参考实现。也许您可以使用 IronPython 在您的 C# 项目中使用它。基本上,您创建一个清单对象:

manifest = factory.manifest(label="Example Manifest")
seq = manifest.sequence()  # unlabeled, anonymous sequence

然后您可以动态添加画布:

for p in range(10):
    # Create a canvas with uri slug of page-1, and label of Page 1
    cvs = seq.canvas(ident="page-%s" % p, label="Page %s" % p)

    # Create an annotation on the Canvas
    anno = cvs.annotation()

    # Add Image: http://www.example.org/path/to/image/api/p1/full/full/0/native.jpg
    img = anno.image("p%s" % p, iiif=True)

    # Set image height and width, and canvas to same dimensions
    imagefile = "/path/to/images/p%s.jpg" % p
    img.set_hw_from_file(imagefile) 

API 3.0

我构建了自己的 Python 模块来处理称为IIIFpres的 3.0 IIIF 演示 API ,您可以考虑尝试一下:

from IIIFpres import iiifpapi3
iiifpapi3.BASE_URL = "https://iiif.io/api/cookbook/recipe/0009-book-1"
manifest = iiifpapi3.Manifest()
manifest.set_id(extendbase_url="manifest.json")
manifest.add_label("en","Simple Manifest - Book")
manifest.add_behavior("paged")

data = (("Blank page",3204,4613,"https://iiif.io/api/image/3.0/example/reference/59d09e6773341f28ea166e9f3c1e674f-gallica_ark_12148_bpt6k1526005v_f18","/full/max/0/default.jpg"),
        ("Frontispiece",3186,4612,"https://iiif.io/api/image/3.0/example/reference/59d09e6773341f28ea166e9f3c1e674f-gallica_ark_12148_bpt6k1526005v_f19","/full/max/0/default.jpg"),
        ("Title page",3204,4613,"https://iiif.io/api/image/3.0/example/reference/59d09e6773341f28ea166e9f3c1e674f-gallica_ark_12148_bpt6k1526005v_f20","/full/max/0/default.jpg"),
        ("Blank page",3174,4578,"https://iiif.io/api/image/3.0/example/reference/59d09e6773341f28ea166e9f3c1e674f-gallica_ark_12148_bpt6k1526005v_f21","/full/max/0/default.jpg"),
        ("Bookplate",3198,4632,"https://iiif.io/api/image/3.0/example/reference/59d09e6773341f28ea166e9f3c1e674f-gallica_ark_12148_bpt6k1526005v_f22","/full/max/0/default.jpg"),)

for idx,d in enumerate(data):
    idx+=1 
    canvas = iiifpapi3.Canvas()
    canvas.set_id(extendbase_url=["canvas","p%s"%idx]) # in this case we use the base url
    canvas.set_height(d[2])
    canvas.set_width(d[1])
    canvas.add_label("en",d[0])
    annopage = iiifpapi3.AnnotationPage()
    annopage.set_id(extendbase_url=["page","p%s"%idx,"1"])
    annotation = iiifpapi3.Annotation(target=canvas.id)
    annotation.set_id(extendbase_url=["annotation","p%s-image"%str(idx).zfill(4)])
    annotation.set_motivation("painting")
    annotation.body.set_id("".join(d[3:]))
    annotation.body.set_type("Image")
    annotation.body.set_format("image/jpeg")
    annotation.body.set_width(d[1])
    annotation.body.set_height(d[2])
    s = iiifpapi3.service()
    s.set_id(d[3])
    s.set_type("ImageService3")
    s.set_profile("level1")
    annotation.body.add_service(s)
    # remember to add the item to their container!
    annopage.add_item(annotation)
    canvas.add_item(annopage)
    manifest.add_item(canvas)

manifest.json_save("manifest.json")
于 2021-02-18T17:36:50.017 回答
0

IIIF [国际图像互操作性框架] API 定义了一种 Web 服务,该服务返回图像以响应标准 HTTP 或 HTTPS 请求。URI 可以指示所请求图像的区域、大小、旋转、质量特征和格式。

对于服务器,您可以部署自己的服务器,例如 Loris 服务器或 IIPImage

于 2020-07-13T08:11:08.527 回答