@@ -134,6 +134,8 @@ class PyPortal:
134134 :param regexp_path: The list of regexp strings to get data out (use a single regexp group). Can
135135 be list of regexps for multiple data points. Defaults to ``None`` to not
136136 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.
137139 :param default_bg: The path to your default background image file or a hex color.
138140 Defaults to 0x000000.
139141 :param status_neopixel: The pin for the status NeoPixel. Use ``board.NEOPIXEL`` for the on-board
@@ -182,6 +184,7 @@ def __init__(
182184 headers = None ,
183185 json_path = None ,
184186 regexp_path = None ,
187+ convert_image = True ,
185188 default_bg = 0x000000 ,
186189 status_neopixel = None ,
187190 text_font = None ,
@@ -207,6 +210,7 @@ def __init__(
207210 ):
208211
209212 self ._debug = debug
213+ self ._convert_image = convert_image
210214
211215 try :
212216 if hasattr (board , "TFT_BACKLIGHT" ):
@@ -956,21 +960,23 @@ def fetch(self, refresh_url=None, timeout=10):
956960 if image_url :
957961 try :
958962 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 )
974980 # convert image to bitmap and cache
975981 # print("**not actually wgetting**")
976982 filename = "/cache.bmp"
0 commit comments