qgis_deployment_toolbelt.utils.check_image_size module#

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

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

qgis_deployment_toolbelt.utils.check_image_size.check_image_dimensions(image_filepath: Path, min_width: int = 500, max_width: int = 600, min_height: int = 250, max_height: int = 350, allowed_images_extensions: tuple = ('.jpg', '.jpeg', '.png', '.svg')) bool#

Check input image dimensions against passed limits.

Parameters:
  • image_filepath (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

qgis_deployment_toolbelt.utils.check_image_size.get_image_size(image_filepath: Path) tuple[int, int]#

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

Parameters:

image_filepath (Path) – path to the image

Return Tuple[int, int]:

dimensions tuple (width,height)

qgis_deployment_toolbelt.utils.check_image_size.get_svg_size(image_filepath: Path) tuple[int, int]#

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.

Parameters:

image_filepath (Path) – path to the svg file

Return Tuple[int, int]:

tuple of dimensions as integers (width,height)