https://github.com/mberry/iiif
A rust client for the International Image Interoperability Framework
https://github.com/mberry/iiif
Last synced: about 1 year ago
JSON representation
A rust client for the International Image Interoperability Framework
- Host: GitHub
- URL: https://github.com/mberry/iiif
- Owner: mberry
- License: mit
- Created: 2020-02-26T02:09:37.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-08-20T09:23:32.000Z (almost 4 years ago)
- Last Synced: 2025-01-01T23:11:52.116Z (over 1 year ago)
- Language: Rust
- Size: 37.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# IIIF
A rust client for the International Image Interoperability Framework.
For now only contains the Image API.
### Install
```toml
[dependencies]
iiif = "0.1.1"
```
### Usage
A convenience fetch function is provided and will create a new client for each
request, it is advised to create a reusable client and
pass that to the request function for multiple requests.
##### Fetch and write to file
```rust
let api = Image::new("https://ids.lib.harvard.edu/ids/iiif");
api.identifier("25286607");
let response = api.fetch()
.await
.unwrap();
// Write to foo.jpg
response.write_to_file("foo.jpg")
.await
.expect("Writing file to disk");
```
##### Reusable client requests
```rust
let client = Client::new();
let base = "https://ids.lib.harvard.edu/ids/iiif";
let mut images: Vec = Vec::new();
// Iterate through some images
let ids = ["25286607", "25286608", "25286609"];
for id in ids {
let mut api = Image::new(base);
api.identifier(id);
let response = api.request(&client)
.await
.unwrap();
images.push(response.image);
```