Retrieve image from BNF

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.

Value

a matrix of the 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.