knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

:package: bnfimage – API client to BnF images

Lifecycle: maturing R-CMD-check codecov CRAN-version

bnfimage 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.

:wrench: Installation

You can install the development version of bnfimage with:

remotes::install_github("Rekyt/bnfimage")

:memo: Example

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"))

:boom: Rate limitation


:page_facing_up: Data license

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.

:information_source: Related projects

gargallica is a collection of script and functions to retrieve data from the regular Gallica API.

:speech_balloon: Code of Conduct

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.



Rekyt/bnfimage documentation built on April 18, 2021, 10:07 p.m.