Package 'bnfimage'

Title: 'BnF Image API' Client
Description: Provides an R client for the image API of 'Bibliothèque Nationale de France' (BnF, National Library of France) <https://api.bnf.fr/api-iiif-de-recuperation-des-images-de-gallica#/>.
Authors: Matthias Grenié [aut, cre]
Maintainer: Matthias Grenié <[email protected]>
License: GPL-3
Version: 0.1.0
Built: 2024-10-25 02:44:35 UTC
Source: https://github.com/Rekyt/bnfimage

Help Index


Retrieve both image data and metadata

Description

This function queries both data and associated metadata from a BNF image using specified parameters and return the information in a tidy data.frame

Usage

bi_all_data(
  identifier = NULL,
  region = c(0L, 0L, 500L, 500L),
  size = "full",
  rotation = 0,
  quality = c("native", "color", "gray", "bitonal"),
  format = c("jpg", "tif", "png", "gif", "jp2", "pdf")
)

Arguments

identifier

[⁠character(1+)⁠]
one or multiple identifier(s) of the document that begins with "ark:/"

region

[character(1) or integer(4)]
either "full" to retrieve the full image or a vector of four integers that defines the region to extract from the image. The vector has the form ⁠(x0, y0, w, h)⁠ with ⁠x0, y0⁠ the coordinates of the top left point of the extracted region (with the origin at the top left of the image), w the width of the extracted region and h the height of the extracted region.

size

[character(1) or integer(2)]
either "full" to retrieve the full region or a vector of two integers that defines the size of the final image

rotation

[numeric(1)]
an integer that defines the rotation in degrees to apply to the final image (0 for no rotation)

quality

[character(1)]

  • "native" for native colors of the image or,

  • "color" for the image in color,

  • "gray" for levels of gray,

  • "bitonal" for only black and white pixels.

format

[character(1)]

  • "jpg" for JPEG image,

  • "tif" for TIFF image,

  • "png" for PNG image,

  • "gif" for GIF image,

  • "jp2" for JP2 image,

  • "pdf" for PDF image.

Value

a tibble with both the image and the metadata, with one row per identifier


Retrieve image from BNF

Description

Retrieve image from BNF

Usage

bi_image(
  identifier = NULL,
  region = c(0L, 0L, 500L, 500L),
  size = "full",
  rotation = 0,
  quality = c("native", "color", "gray", "bitonal"),
  format = c("jpg", "tif", "png", "gif", "jp2", "pdf")
)

Arguments

identifier

[character(1)]
identifier of the document that begins with "ark:/"

region

[character(1) or integer(4)]
either "full" to retrieve the full image or a vector of four integers that defines the region to extract from the image. The vector has the form ⁠(x0, y0, w, h)⁠ with ⁠x0, y0⁠ the coordinates of the top left point of the extracted region (with the origin at the top left of the image), w the width of the extracted region and h the height of the extracted region.

size

[character(1) or integer(2)]
either "full" to retrieve the full region or a vector of two integers that defines the size of the final image

rotation

[numeric(1)]
an integer that defines the rotation in degrees to apply to the final image (0 for no rotation)

quality

[character(1)]

  • "native" for native colors of the image or,

  • "color" for the image in color,

  • "gray" for levels of gray,

  • "bitonal" for only black and white pixels.

format

[character(1)]

  • "jpg" for JPEG image,

  • "tif" for TIFF image,

  • "png" for PNG image,

  • "gif" for GIF image,

  • "jp2" for JP2 image,

  • "pdf" for PDF image.

Details

By default bnfimage implements rate limitation through the ratelimitr package. The query are limited to a maximum of 1 every 3 seconds to avoid being blocked by the BnF server. This is the limit at which the BnF server considers the queries to be malicious. For the moment this limitation cannot be lifted.

Value

a matrix of the image


Retrieve BnF image metadata

Description

Retrieve BnF image metadata

Usage

bi_metadata(identifier = NULL)

Arguments

identifier

[character(1)]
identifier of the document that begins with "ark:/"

Details

By default bnfimage implements rate limitation through the ratelimitr package. The query are limited to a maximum of 1 every 3 seconds to avoid being blocked by the BnF server. This is the limit at which the BnF server considers the queries to be malicious. For the moment this limitation cannot be lifted.

Value

A nested list which contains the metadata of a single element. The list is for now not formatted and provide the full metadata returned by the API.