Skip to content

Commit

Permalink
Merge pull request #5985 from radarhere/psd
Browse files Browse the repository at this point in the history
Removed unused variables
  • Loading branch information
hugovk authored Jan 24, 2022
2 parents 0a49ec1 + 31aa2ad commit 76115e3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Tests/test_file_psd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 1 addition & 7 deletions src/PIL/PsdImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ def read(size):
x1 = i32(read(4))

# image info
info = []
mode = []
ct_types = i16(read(2))
types = list(range(ct_types))
Expand All @@ -211,8 +210,7 @@ def read(size):
m = "RGBA"[type]

mode.append(m)
size = i32(read(4))
info.append((m, size))
read(4) # size

# figure out the image mode
mode.sort()
Expand All @@ -229,26 +227,22 @@ def read(size):
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)))
Expand Down

0 comments on commit 76115e3

Please sign in to comment.