PDF recoding

internetarchivepdf.recode.guess_dpi(w, h, expected_format=(8.27, 11.69), round_to=[72, 96, 150, 300, 600])[source]

Guesstimate DPI for a given image.

Args:

  • w (int): width of the image

  • h (int): height of the image

  • expected_format (tuple): (width_inch, height_inch) of expected document,

    defaults to european A4.

  • round_to (list of int): List of acceptable DPI values.

    Defaults to (72, 96, 150, 300, 600)

Returns an int which is the best matching DPI picked from round_to.