diff --git a/Tests/test_file_psd.py b/Tests/test_file_psd.py index f50fe133f..a7f379e55 100644 --- a/Tests/test_file_psd.py +++ b/Tests/test_file_psd.py @@ -123,7 +123,7 @@ def test_no_icc_profile(): def test_combined_larger_than_size(): - # The 'combined' sizes of the individual parts is larger than the + # The combined size of the individual parts is larger than the # declared 'size' of the extra data field, resulting in a backwards seek. # If we instead take the 'size' of the extra data field as the source of truth, diff --git a/src/PIL/PsdImagePlugin.py b/src/PIL/PsdImagePlugin.py index 04b21e3de..550a333dd 100644 --- a/src/PIL/PsdImagePlugin.py +++ b/src/PIL/PsdImagePlugin.py @@ -195,7 +195,6 @@ def _layerinfo(fp, ct_bytes): x1 = i32(read(4)) # image info - info = [] mode = [] ct_types = i16(read(2)) types = list(range(ct_types)) @@ -211,8 +210,7 @@ def _layerinfo(fp, ct_bytes): m = "RGBA"[type] mode.append(m) - size = i32(read(4)) - info.append((m, size)) + read(4) # size # figure out the image mode mode.sort() @@ -229,26 +227,22 @@ def _layerinfo(fp, ct_bytes): read(12) # filler name = "" size = i32(read(4)) # length of the extra data field - combined = 0 if size: data_end = fp.tell() + size length = i32(read(4)) if length: fp.seek(length - 16, io.SEEK_CUR) - combined += length + 4 length = i32(read(4)) if length: fp.seek(length, io.SEEK_CUR) - combined += length + 4 length = i8(read(1)) if length: # Don't know the proper encoding, # Latin-1 should be a good guess name = read(length).decode("latin-1", "replace") - combined += length + 1 fp.seek(data_end) layers.append((name, mode, (x0, y0, x1, y1)))