knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
bnfimage
– API client to BnF imagesbnfimage
is an R client for the BnF images API.
The Bibliothèque Nationale de France (BnF), has a online repository called Gallica containing millions of scanned documents. The BnF offers an API to access all the images programmatically, bnfimage
lets you access it through R.
The BnF Image API is implemented following the International Image Interoperability Framework (IIIF) with Image API implemented using v.1.1, the Presentation API implemented using v.2.0, and the Search API not yet implemented.
You can install the development version of bnfimage with:
remotes::install_github("Rekyt/bnfimage")
You can extract images with the bi_image()
function:
library(bnfimage) eiffel_tower = bi_image( identifier = "ark:/12148/btv1b9055204k/f1", region = "full", size = c(1500, 750), rotation = 0, quality = "native", format = "png") str(eiffel_tower) eiffel_tower
You can get the metadata associated with this image using bi_metadata()
:
eiffel_metadata = bi_metadata("ark:/12148/btv1b9055204k/f1") str(eiffel_metadata, max.l = 2)
You can query both data and associated metadata using the bi_all_data()
function and get a nicely formatted tibble:
bi_all_data("ark:/12148/btv1b9055204k/f1", size = c(15, 7))
You can also provide several identifiers to bi_all_data()
:
bi_all_data(c("ark:/12148/btv1b9055204k/f1", "ark:/12148/btv1b90055455/f1"))
Note that the images from Gallica have a specific license so make sure to check the license of the images you plan to reuse. As a general rule, non-commercial reuse is free of charge but the source should be speficied as "Source gallica.bnf.fr / Bibliothèque nationale de France" or "Source gallica.bnf.fr / BnF". Commercial reuse should be license specifically following the price list.
gargallica
is a collection of script and functions to retrieve data from the regular Gallica API.
Please note that the bnfimage
project is released with a
Contributor Code of Conduct.
By contributing to this project, you agree to abide by its terms.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.