You need to set the format parameter in your call to the save function to ‘JPEG’:
from PIL import Image
img = Image.open('car.jpg')
new_img = img.resize((500,500))
new_img.save("car_resized.jpg", "JPEG", optimize=True)
More Related Contents:
- Python 2.7 IndentationError [closed]
- Python – ‘ascii’ codec can’t decode byte
- Defining “boolness” of a class in python
- Why does ENcoding a string result in a DEcoding error (UnicodeDecodeError)?
- TypeError: super() takes at least 1 argument (0 given) error is specific to any python version?
- ImportError: DLL load failed: %1 is not a valid Win32 application for Python Matplotlib
- python 2.7 script to add a column
- Python 2: Conditional statement behaviour of lists with greater/smaller [duplicate]
- What is the difference between range and xrange functions in Python 2.X?
- Reading an Excel file in python using pandas
- Insert an element at a specific index in a list and return the updated list
- Backporting Python 3 open(encoding=”utf-8″) to Python 2
- Accessing attributes on literals work on all types, but not `int`; why? [duplicate]
- python how to decode http response
- Fastest way to process a large file?
- How to integrate Pygame and PyQt4?
- Cannot use Requests-Module on AWS Lambda
- UnicodeEncodeError: ‘ascii’ codec can’t encode characters in position 0-5: ordinal not in range(128) [duplicate]
- Can’t install mysql-python (newer versions) in Windows
- python re.sub, only replace part of match [duplicate]
- Mock Python’s built in print function
- Pretty print JSON dumps
- Pyodbc error Data source name not found and no default driver specified paradox
- how can i remove notifications and alerts from browser? selenium python 2.7.7
- Printing on the same line with time.sleep()
- Python Pandas add column for row-wise max value of selected columns [duplicate]
- Python decorator best practice, using a class vs a function
- How to check if a variable is an integer or a string? [duplicate]
- What arguments does Python sort() function have?
- How to filter a DataFrame column of lists for those that contain a certain item