Crates.io | iiif |
lib.rs | iiif |
version | 0.1.1 |
source | src |
created_at | 2020-02-26 09:53:57.78836 |
updated_at | 2020-02-28 03:28:00.385565 |
description | A client library for the International Image Interoperability Framework (IIIF) |
homepage | |
repository | https://github.com/mitchellberry/iiif |
max_upload_size | |
id | 212666 |
size | 60,382 |
A rust client for the International Image Interoperability Framework.
For now only contains the Image API.
[dependencies]
iiif = "0.1.0"
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.
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");
let client = Client::new();
let base = "https://ids.lib.harvard.edu/ids/iiif";
let mut images: Vec<Bytes> = 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);
}