We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a3cfd91 commit 8251dbeCopy full SHA for 8251dbe
src/PIL/EpsImagePlugin.py
@@ -157,8 +157,9 @@ def Ghostscript(
157
startupinfo = subprocess.STARTUPINFO()
158
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
159
subprocess.check_call(command, startupinfo=startupinfo)
160
- out_im = Image.open(outfile)
161
- out_im.load()
+ with Image.open(outfile) as out_im:
+ out_im.load()
162
+ return out_im.im.copy()
163
finally:
164
try:
165
os.unlink(outfile)
@@ -167,10 +168,6 @@ def Ghostscript(
167
168
except OSError:
169
pass
170
- im = out_im.im.copy()
171
- out_im.close()
172
- return im
173
-
174
175
def _accept(prefix: bytes) -> bool:
176
return prefix[:4] == b"%!PS" or (len(prefix) >= 4 and i32(prefix) == 0xC6D3D0C5)
0 commit comments