IIIF 图像 API
与IIIF Image API合作的一系列帮助者.
兼容性
IIIF 规格
- IIIF 图像 3.0 - 完全兼容
- IIIF 图像 2. 0 - 完全兼容
- IIIF 图像 1.0 - 无支持
IIIF 概况级别
看看这个 遵守版本 更多信息。 此库支持检测0至2级至IIIF图像 API 3.0级.
文档
这个库是一个工具箱,作为更大的应用程序或库的一部分. 这些文件仍在编写中,但有打字定义被运出 您可以在您的 IDE 或编辑器中探索 API.
图像服务加载器
这是图书馆的主要部分。 它利用所有组件来创建一个单一的图像服务加载库.
import { ImageServiceLoader } from '@atlas-viewer/iiif-image-api';
const loader = new ImageServiceLoader();
loader.loadService({
id: 'http://some-service/some-path',
width: 1000,
height: 1000,
}).then(service => {
// full image service available
// service
});
loader.getThumbnailFromResource(
// Content resource.
{
id: 'http://some-service/some-image/default.jpg',
width: 1000,
height: 2000,
service: [
{
id: 'http://some-service/some-path',
type: 'Service',
profile: 'level0',
}
]
},
// Thumbnail options.
{
maxWidth: 200,
maxHeight: 200,
preferFixedSize: true,
},
// Dereference image service.
true
);
服务简介
以下剖面图将匹配并映射到IIIF的相符合水平:
- http://iif.io/api/image/2/level0 (英语)
- http://iiif.io/api/image/2/level 1 (英语)
- http://iiif.io/api/image/2/level2 (英语)
- http://library.stanford.edu/iif/image-api/遵义.html#level0
- http://library.stanford.edu/iif/image-api/遵义.html#level1 (中文(简体) )
- http://library.stanford.edu/iif/image-api/遵义.html#平分2级
- http://library.stanford.edu/iif/image-api/conformance.html#level0 (英语)
- http://library.stanford.edu/iif/image-api/conformance.html#level1 (中文(简体) )
- http://library.stanford.edu/iif/image-api/conformance.html#level2 (中文(简体) )
- http://library.stanford.edu/iif/image-api/1.1/遵义.html#level0
- http://library.stanford.edu/iif/image-api/1.1/遵规.html#level1
- http://library.stanford.edu/iif/image-api/1.1/遵义.html#level2
- http://library.stanford.edu/iif/image-api/1.1/conformance.html#level0 (中文(简体) )
- http://library.stanford.edu/iif/image-api/1.1/conformance.html#level1 (中文(简体) )
- http://library.stanford.edu/iif/image-api/1.1/conformance.html#level2 (中文(简体) )
- http://iif.io/api/image/1/level.json (英语)
- http://iiif.io/api/image/1/profiles/level0.json 页面存档备份,存于互联网档案馆
- http://iiif.io/api/image/1/level1.json (英语)
- http://iiif.io/api/image/1/profiles/level1.json (英语)
- http://iiif.io/api/image/1/level2.json (英语)
- http://iiif.io/api/image/1/profiles/level2.json (英语)
- http://iiif.io/api/image/2/level0.json (英语)
- http://iif.io/api/image/2/profiles/level0.json (英语)
- http://iif.io/api/image/2/level1.json (英语)
- http://iiif.io/api/image/2/profiles/level1.json 页面存档备份,存于互联网档案馆
- http://iiif.io/api/image/2/level2.json (英语)
- http://iiif.io/api/image/2/profiles/level2.json (英语)
- 0级
- 级别1
- 级别2
图像服务
在图像服务对象中接受,如果是支持的图像服务,则返回真实值 .
import { isImageService } from '@atlas-viewer/iiif-image-api';
isImageService({
id: 'http://some-service/some-path',
type: 'Service',
profile: 'level0',
}); // true
警犬服务
将图像服务端点规范化,以确保它具有 info.json 附录.
import { canonicalServiceUrl } from '@atlas-viewer/iiif-image-api';
canonicalServiceUrl('http://some-service/some-path'); // http://some-service/some-path/info.json
提取FixedSize 缩放
鉴于图像大小和高度与宽度的列表,这按照输入的顺序返回每个大小的尺度.
import { extractFixedSizeScales } from '@atlas-viewer/iiif-image-api';
extractFixedSizeScales(1000, 2000, [
{ width: 100, height: 200 },
{ width: 500, height: 1000 }
]); // [ 10, 2 ]
缩放
与此相反的行动 extractFixedSizeScales 从缩放列表中返回大小列表.
import { extractFixedSizeScales } from '@atlas-viewer/iiif-image-api';
extractFixedSizeScales(1000, 2000, [10, 2]);
// returns:
// [ { width: 100, height: 200 }, { width: 500, height: 1000 } ]
从服务中获取自定义大小
鉴于服务, 这将返回一个对象, 给使用该服务生成图像带来限制 配置文件以及可用的最大宽度和最大高度属性。 如果服务包含平板, 将使用 瓷砖的定义.
整个这个库使用的回放值是用来描述一个可以用来创建真实图像的图像候选人.
import { getCustomSizeFromService } from '@atlas-viewer/iiif-image-api';
getCustomSizeFromService({
id: 'http://some-service/some-path',
profile: 'image2',
tiles: [
{ width: 256, height: 256 },
{ width: 512, height: 512 },
]
});
const returns = [
{
id: 'http://some-service/some-path',
type: 'variable',
minHeight: 0,
minWidth: 0,
maxHeight: 256,
maxWidth: 256,
},
{
id: 'http://some-service/some-path',
type: 'variable',
minHeight: 0,
minWidth: 0,
maxHeight: 512,
maxWidth: 512,
}
];
从图像中获取FixedSize
这需要内容资源 – 通常在 IIIF 演示文稿表的注解或缩略图属性正文中 – 并试图找到资源大小。 这只是表示资源大小,不应用作 一个真相的来源。 在内部,这用于检测潜在的非常大图像并避免渲染.
import { getFixedSizeFromImage } from '@atlas-viewer/iiif-image-api';
// Normal image resources.
getFixedSizeFromImage({
id: 'http://some-service/some-path/image.jpg',
type: 'Image',
width: 100,
height: 200,
});
const returns = {
id: 'http://some-service/some-path/image.jpg',
type: 'fixed',
width: 100,
height: 200,
};
// Unknown size.
getFixedSizeFromImage('http://some-service/some-path/image.jpg');
const returns = {
id: 'http://some-service/some-path/image.jpg',
type: 'unknown',
};