C# 如何为Universal Viewer动态创建manifest.json
我正在从.Net web应用程序中显示Universal Viewer。 我有许多JP2图像存储在IIP图像服务器。 现在,我想创建manifest.json来为我的通用查看器提供信息。 是否可以为存储在image server中的所有图像动态创建画布。 请帮帮我C# 如何为Universal Viewer动态创建manifest.json,c#,manifest.json,jpeg2000,iiif,C#,Manifest.json,Jpeg2000,Iiif,我正在从.Net web应用程序中显示Universal Viewer。 我有许多JP2图像存储在IIP图像服务器。 现在,我想创建manifest.json来为我的通用查看器提供信息。 是否可以为存储在image server中的所有图像动态创建画布。 请帮帮我 感谢IIIF[International Image Interoperability Framework]API定义了一个web服务,该服务返回图像以响应标准HTTP或HTTPS请求。URI可以指示所请求图像的区域、大小、旋转、质量
感谢IIIF[International Image Interoperability Framework]API定义了一个web服务,该服务返回图像以响应标准HTTP或HTTPS请求。URI可以指示所请求图像的区域、大小、旋转、质量特征和格式
对于服务器,您可以部署自己的服务器,例如Loris服务器或IIIF presentation API 2.0和早期版本的IIPImage。有一个用于Python的优秀工具,它是一个参考实现。也许您可以在C#项目中使用IronPython。基本上,创建清单对象:
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
< P>我构建了自己的Python模块来处理3 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")
对不起,这不是我问题的具体答案。谢谢。你的元数据存储在哪里?iiif清单主要使用metadada构建,而不是使用图像(大小和名称除外)。