@@ -125,14 +125,18 @@ def apply_options_in_url(logger, request_options: TSC.RequestOptions, value: str
125125 request_options .max_age = 0 # type: ignore
126126 logger .debug ("Set max age to {} from {}" .format ((TSC .ImageRequestOptions (request_options )).max_age , value ))
127127 elif ":size" == setting_name :
128- # this is only used by get as png
129- try :
130- height , width = setting_val .split ("," )
131- (TSC .ImageRequestOptions (request_options )).viz_height = int (height )
132- (TSC .ImageRequestOptions (request_options )).viz_width = int (width )
133- except Exception as oops :
134- logger .warn ("Unable to read image size options '{}', skipping" .format (setting_val ))
135- logger .warn (oops )
128+ if isinstance (request_options , (TSC .ImageRequestOptions , TSC .PDFRequestOptions )):
129+ try :
130+ height , width = setting_val .split ("," )
131+ request_options .viz_height = int (height )
132+ request_options .viz_width = int (width )
133+ except Exception as oops :
134+ logger .warn ("Unable to read image size options '{}', skipping" .format (setting_val ))
135+ logger .warn (oops )
136+ else :
137+ logger .debug (
138+ "Request options are not of type ImageRequestOptions or PDFRequestOptions, skipping size setting"
139+ )
136140 else :
137141 logger .debug ("Parameter[s] not recognized: {}" .format (value ))
138142
@@ -147,8 +151,10 @@ def apply_png_options(logger, request_options: TSC.ImageRequestOptions, args):
147151 request_options .viz_height = int (args .height )
148152 if args .width :
149153 request_options .viz_width = int (args .width )
150- # Always request high-res images
151- request_options .image_resolution = "high"
154+ if args .resolution and args .resolution != TSC .ImageRequestOptions .Resolution .High .lower ():
155+ request_options .image_resolution = None
156+ else :
157+ request_options .image_resolution = TSC .ImageRequestOptions .Resolution .High .lower ()
152158
153159 @staticmethod
154160 def apply_pdf_options (logger , request_options : TSC .PDFRequestOptions , args ):
0 commit comments