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