i3f
中文
简介
i3f 是一个用 Rust 实现的 IIIF (International Image Interoperability Framework) API 库,支持 IIIF Image API 3.0 和 Presentation API 3.0 规范。
功能特性
-
✅ IIIF Image API 3.0 完整支持
- 图像区域裁剪(Region):支持
full、square、像素坐标和百分比坐标 - 图像尺寸调整(Size):支持多种尺寸参数格式
- 图像旋转(Rotation):支持 90 度倍数旋转和任意角度旋转
- 图像质量(Quality):支持
default、color、gray、bitonal - 图像格式(Format):支持
jpg、png、gif、webp、tif、jp2、pdf - 图像信息(Info):完整的
info.json结构支持
- 图像区域裁剪(Region):支持
-
✅ IIIF Presentation API 3.0 完整支持
- Collection(集合)
- Manifest(清单)
- Canvas(画布)
- Range(范围)
- Annotation(注解)
- AnnotationPage(注解页)
-
✅ 图像处理能力
- 支持任意角度旋转(使用
imageproc库) - 90 度倍数旋转优化(使用
image库内置方法) - 透明背景填充
- 自动边界框计算
- 支持任意角度旋转(使用
-
✅ 存储抽象
- 本地文件系统存储(LocalStorage)
- 可扩展的存储接口
安装
在 Cargo.toml 中添加依赖:
[]
= "0.1.0"
快速开始
解析 IIIF Image URL
use IiifImage;
use Url;
let url = parse?;
let image = try_from?;
println!;
println!;
println!;
println!;
println!;
println!;
处理图像
use ;
use Url;
let url = parse?;
let image = try_from?;
let storage = new;
let processed_image = image.process?;
// 保存处理后的图像
processed_image.save?;
创建 Presentation Manifest
use ;
use HashMap;
let mut label = new;
label.insert;
label.insert;
let manifest = Manifest ;
// 序列化为 JSON
let json = to_string_pretty?;
println!;
模块说明
-
image: IIIF Image API 3.0 实现IiifImage: 图像请求解析和处理Region: 区域裁剪Size: 尺寸调整Rotation: 旋转处理Quality: 质量设置Format: 格式转换ImageInfo: 图像信息结构
-
presentation: IIIF Presentation API 3.0 实现Collection: 集合结构Manifest: 清单结构Canvas: 画布结构Range: 范围结构Annotation: 注解结构AnnotationPage: 注解页结构
-
storage: 存储抽象Storage: 存储接口LocalStorage: 本地文件系统存储实现
-
error: 错误类型IiifError: IIIF 相关错误枚举
文档
许可证
MIT License
贡献
欢迎提交 Issue 和 Pull Request!
English
Introduction
i3f is a Rust implementation of the IIIF (International Image Interoperability Framework) API library, supporting IIIF Image API 3.0 and Presentation API 3.0 specifications.
Features
-
✅ Full IIIF Image API 3.0 Support
- Image Region: Supports
full,square, pixel coordinates, and percentage coordinates - Image Size: Supports multiple size parameter formats
- Image Rotation: Supports 90-degree multiples and arbitrary angle rotation
- Image Quality: Supports
default,color,gray,bitonal - Image Format: Supports
jpg,png,gif,webp,tif,jp2,pdf - Image Info: Complete
info.jsonstructure support
- Image Region: Supports
-
✅ Full IIIF Presentation API 3.0 Support
- Collection
- Manifest
- Canvas
- Range
- Annotation
- AnnotationPage
-
✅ Image Processing Capabilities
- Arbitrary angle rotation (using
imageproclibrary) - Optimized 90-degree multiple rotation (using
imagelibrary built-in methods) - Transparent background filling
- Automatic bounding box calculation
- Arbitrary angle rotation (using
-
✅ Storage Abstraction
- Local file system storage (LocalStorage)
- Extensible storage interface
Installation
Add the dependency to your Cargo.toml:
[]
= "0.1.0"
Quick Start
Parse IIIF Image URL
use IiifImage;
use Url;
let url = parse?;
let image = try_from?;
println!;
println!;
println!;
println!;
println!;
println!;
Process Image
use ;
use Url;
let url = parse?;
let image = try_from?;
let storage = new;
let processed_image = image.process?;
// Save the processed image
processed_image.save?;
Create Presentation Manifest
use ;
use HashMap;
let mut label = new;
label.insert;
label.insert;
let manifest = Manifest ;
// Serialize to JSON
let json = to_string_pretty?;
println!;
Modules
-
image: IIIF Image API 3.0 implementationIiifImage: Image request parsing and processingRegion: Region croppingSize: Size adjustmentRotation: Rotation processingQuality: Quality settingsFormat: Format conversionImageInfo: Image information structure
-
presentation: IIIF Presentation API 3.0 implementationCollection: Collection structureManifest: Manifest structureCanvas: Canvas structureRange: Range structureAnnotation: Annotation structureAnnotationPage: Annotation page structure
-
storage: Storage abstractionStorage: Storage interfaceLocalStorage: Local file system storage implementation
-
error: Error typesIiifError: IIIF-related error enumeration
Documentation
License
MIT License
Contributing
Issues and Pull Requests are welcome!