diff --git a/adafruit_pyportal.py b/adafruit_pyportal.py index f8e96a1..34583fa 100644 --- a/adafruit_pyportal.py +++ b/adafruit_pyportal.py @@ -126,6 +126,8 @@ class PyPortal: :param regexp_path: The list of regexp strings to get data out (use a single regexp group). Can be list of regexps for multiple data points. Defaults to ``None`` to not use regexp. + :param convert_image: Determine whether or not to use the AdafruitIO image converter service. + Set as False if your image is already resized. Defaults to True. :param default_bg: The path to your default background image file or a hex color. Defaults to 0x000000. :param status_neopixel: The pin for the status NeoPixel. Use ``board.NEOPIXEL`` for the on-board @@ -174,6 +176,7 @@ def __init__( headers=None, json_path=None, regexp_path=None, + convert_image=True, default_bg=0x000000, status_neopixel=None, text_font=None, @@ -199,6 +202,7 @@ def __init__( ): self._debug = debug + self._convert_image = convert_image try: if hasattr(board, "TFT_BACKLIGHT"): @@ -944,21 +948,23 @@ def fetch(self, refresh_url=None, timeout=10): if image_url: try: print("original URL:", image_url) - if iwidth < iheight: - image_url = self.image_converter_url( - image_url, - int( - self._image_resize[1] - * self._image_resize[1] - / self._image_resize[0] - ), - self._image_resize[1], - ) - else: - image_url = self.image_converter_url( - image_url, self._image_resize[0], self._image_resize[1] - ) - print("convert URL:", image_url) + if self._convert_image: + if iwidth < iheight: + image_url = self.image_converter_url( + image_url, + int( + self._image_resize[1] + * self._image_resize[1] + / self._image_resize[0] + ), + self._image_resize[1], + ) + else: + image_url = self.image_converter_url( + image_url, self._image_resize[0], self._image_resize[1] + ) + + print("convert URL:", image_url) # convert image to bitmap and cache # print("**not actually wgetting**") filename = "/cache.bmp"