mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 01:46:18 +03:00
Fix load_djpeg and _save_cjpeg in windows
This commit is contained in:
parent
bd9c555905
commit
c0fb5ace23
|
@ -360,8 +360,7 @@ class JpegImageFile(ImageFile.ImageFile):
|
||||||
f, path = tempfile.mkstemp()
|
f, path = tempfile.mkstemp()
|
||||||
os.close(f)
|
os.close(f)
|
||||||
if os.path.exists(self.filename):
|
if os.path.exists(self.filename):
|
||||||
with open(path, 'wb') as f:
|
subprocess.check_call(["djpeg", "-outfile", path, self.filename])
|
||||||
subprocess.check_call(["djpeg", self.filename], stdout=f)
|
|
||||||
else:
|
else:
|
||||||
raise ValueError("Invalid Filename")
|
raise ValueError("Invalid Filename")
|
||||||
|
|
||||||
|
@ -606,8 +605,7 @@ def _save_cjpeg(im, fp, filename):
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
tempfile = im._dump()
|
tempfile = im._dump()
|
||||||
with open(filename, 'wb') as f:
|
subprocess.check_call(["cjpeg", "-outfile", filename, tempfile])
|
||||||
subprocess.check_call(["cjpeg", tempfile], stdout=f)
|
|
||||||
try:
|
try:
|
||||||
os.unlink(file)
|
os.unlink(file)
|
||||||
except:
|
except:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user