File tree Expand file tree Collapse file tree 1 file changed +14
-9
lines changed
Expand file tree Collapse file tree 1 file changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -320,21 +320,26 @@ def read_comment(s: str) -> bool:
320320 # binary/ascii (1: binary, 2: ascii)
321321 # data start identifier (the image data follows after a single line
322322 # consisting only of this quoted value)
323+ if imagedata_size :
324+ bytes_read = 0
325+ continue
326+
323327 image_data_values = byte_arr [11 :bytes_read ].split (None , 7 )
324328 columns , rows , bit_depth , mode_id = (
325329 int (value ) for value in image_data_values [:4 ]
326330 )
327331
328- if not imagedata_size :
329- imagedata_size = columns , rows
332+ if bit_depth == 1 :
333+ self ._mode = "1"
334+ elif bit_depth == 8 :
335+ try :
336+ self ._mode = self .mode_map [mode_id ]
337+ except ValueError :
338+ break
339+ else :
340+ break
330341
331- if bit_depth == 1 :
332- self ._mode = "1"
333- elif bit_depth == 8 :
334- try :
335- self ._mode = self .mode_map [mode_id ]
336- except ValueError :
337- pass
342+ imagedata_size = columns , rows
338343 elif bytes_mv [:5 ] == b"%%EOF" :
339344 break
340345 elif trailer_reached and reading_trailer_comments :
You can’t perform that action at this time.
0 commit comments