[Image-SIG] PIL with JPEG support on Windows: Error Writing JPEG file
Laura & Edward Cannon
cannon.el at gmail.com
Wed Mar 25 16:45:44 CET 2009
This is correct, windows makes a distinction between text and binary
files, and linux does not, I have had quite a bit of trouble in that
regard, especially as I switched from linux to windows.
On Wed, Mar 25, 2009 at 8:38 AM, Fredrik Lundh <fredrik at pythonware.com> wrote:
> 2009/3/25 Bryan Jeal <bryan at hideawaystudios.com>:
>> Here is an update:
>> I removed Python and PIL from the system and reinstalled them (for PIL I
>> used PIL-1.1.6.win32-py2.5.exe); however, it isn't working correctly...
> I'm not sure why you think you need to open the output file yourself,
> but if you do, you need to tell Python that it's a binary file.
> tmpFile = open('C:/temp/temp_win.jpg', 'w')
> tmpFile = open('C:/temp/temp_win.jpg', 'wb')
> or, easier, changing the save call to
> im.save("c/temp/temp_win.jpg", 'JPEG', quality=90)
> will fix this.
> Image-SIG maillist - Image-SIG at python.org
More information about the Image-SIG