geotribu_cli.utils.check_image_size module

Check image size using pure Python <https://github.com/shibukawa/imagesize_py>.

Author: Julien Moura (https://github.com/guts)

geotribu_cli.utils.check_image_size.check_image_dimensions(image_filepath, min_width=500, max_width=600, min_height=250, max_height=350, allowed_images_extensions=('.jpg', '.jpeg', '.png', '.svg'))

Check input image dimensions against passed limits.

Paramètres:
  • image_filepath (Union[str, Path]) – path to the image to check

  • min_width (int) – minimum width, defaults to 500

  • max_width (int) – maximum width, defaults to 600

  • min_height (int) – minimum height, defaults to 250

  • max_height (int) – maximum height, defaults to 350

Return bool:

True if image dimensions are inferior

Type renvoyé:

bool

geotribu_cli.utils.check_image_size.get_image_dimensions_by_url(url)

Get image dimensions as a tuple (width,height) of an image at an URL. Return None in case of error or no data.

Paramètres:

url (str) – url of the image

Return Tuple[int, int]:

dimensions tuple (width,height)

Type renvoyé:

tuple[int, int]

geotribu_cli.utils.check_image_size.get_image_size(image_filepath)

Get image dimensions as a tuple (width,height). Return None in case of error.

Paramètres:

image_filepath (Path) – path to the image

Return Tuple[int, int]:

dimensions tuple (width,height)

Type renvoyé:

tuple[int, int]

geotribu_cli.utils.check_image_size.get_svg_size(image_filepath)

Extract SVG width and height from a SVG file and convert them into integers. Relevant and working only if the file root has width and height attributes.

Paramètres:

image_filepath (Path) – path to the svg file

Return Tuple[int, int]:

tuple of dimensions as integers (width,height)

Type renvoyé:

tuple[int, int]