@@ -134,6 +134,8 @@ class PyPortal:
134
134
:param regexp_path: The list of regexp strings to get data out (use a single regexp group). Can
135
135
be list of regexps for multiple data points. Defaults to ``None`` to not
136
136
use regexp.
137
+ :param convert_image: Determine whether or not to use the AdafruitIO image converter service.
138
+ Set as False if your image is already resized. Defaults to True.
137
139
:param default_bg: The path to your default background image file or a hex color.
138
140
Defaults to 0x000000.
139
141
:param status_neopixel: The pin for the status NeoPixel. Use ``board.NEOPIXEL`` for the on-board
@@ -182,6 +184,7 @@ def __init__(
182
184
headers = None ,
183
185
json_path = None ,
184
186
regexp_path = None ,
187
+ convert_image = True ,
185
188
default_bg = 0x000000 ,
186
189
status_neopixel = None ,
187
190
text_font = None ,
@@ -207,6 +210,7 @@ def __init__(
207
210
):
208
211
209
212
self ._debug = debug
213
+ self ._convert_image = convert_image
210
214
211
215
try :
212
216
if hasattr (board , "TFT_BACKLIGHT" ):
@@ -956,21 +960,23 @@ def fetch(self, refresh_url=None, timeout=10):
956
960
if image_url :
957
961
try :
958
962
print ("original URL:" , image_url )
959
- if iwidth < iheight :
960
- image_url = self .image_converter_url (
961
- image_url ,
962
- int (
963
- self ._image_resize [1 ]
964
- * self ._image_resize [1 ]
965
- / self ._image_resize [0 ]
966
- ),
967
- self ._image_resize [1 ],
968
- )
969
- else :
970
- image_url = self .image_converter_url (
971
- image_url , self ._image_resize [0 ], self ._image_resize [1 ]
972
- )
973
- print ("convert URL:" , image_url )
963
+ if self ._convert_image :
964
+ if iwidth < iheight :
965
+ image_url = self .image_converter_url (
966
+ image_url ,
967
+ int (
968
+ self ._image_resize [1 ]
969
+ * self ._image_resize [1 ]
970
+ / self ._image_resize [0 ]
971
+ ),
972
+ self ._image_resize [1 ],
973
+ )
974
+ else :
975
+ image_url = self .image_converter_url (
976
+ image_url , self ._image_resize [0 ], self ._image_resize [1 ]
977
+ )
978
+
979
+ print ("convert URL:" , image_url )
974
980
# convert image to bitmap and cache
975
981
# print("**not actually wgetting**")
976
982
filename = "/cache.bmp"
0 commit comments