@@ -126,6 +126,8 @@ class PyPortal:
126
126
:param regexp_path: The list of regexp strings to get data out (use a single regexp group). Can
127
127
be list of regexps for multiple data points. Defaults to ``None`` to not
128
128
use regexp.
129
+ :param convert_image: Determine whether or not to use the AdafruitIO image converter service.
130
+ Set as False if your image is already resized. Defaults to True.
129
131
:param default_bg: The path to your default background image file or a hex color.
130
132
Defaults to 0x000000.
131
133
:param status_neopixel: The pin for the status NeoPixel. Use ``board.NEOPIXEL`` for the on-board
@@ -174,6 +176,7 @@ def __init__(
174
176
headers = None ,
175
177
json_path = None ,
176
178
regexp_path = None ,
179
+ convert_image = False ,
177
180
default_bg = 0x000000 ,
178
181
status_neopixel = None ,
179
182
text_font = None ,
@@ -944,21 +947,23 @@ def fetch(self, refresh_url=None, timeout=10):
944
947
if image_url :
945
948
try :
946
949
print ("original URL:" , image_url )
947
- if iwidth < iheight :
948
- image_url = self .image_converter_url (
949
- image_url ,
950
- int (
951
- self ._image_resize [1 ]
952
- * self ._image_resize [1 ]
953
- / self ._image_resize [0 ]
954
- ),
955
- self ._image_resize [1 ],
956
- )
957
- else :
958
- image_url = self .image_converter_url (
959
- image_url , self ._image_resize [0 ], self ._image_resize [1 ]
960
- )
961
- print ("convert URL:" , image_url )
950
+ if self ._convert_image :
951
+ if iwidth < iheight :
952
+ image_url = self .image_converter_url (
953
+ image_url ,
954
+ int (
955
+ self ._image_resize [1 ]
956
+ * self ._image_resize [1 ]
957
+ / self ._image_resize [0 ]
958
+ ),
959
+ self ._image_resize [1 ],
960
+ )
961
+ else :
962
+ image_url = self .image_converter_url (
963
+ image_url , self ._image_resize [0 ], self ._image_resize [1 ]
964
+ )
965
+
966
+ print ("convert URL:" , image_url )
962
967
# convert image to bitmap and cache
963
968
# print("**not actually wgetting**")
964
969
filename = "/cache.bmp"
0 commit comments