minor fixes related to draft

This commit is contained in:
Alexander 2019-11-24 04:33:34 +03:00
parent 8a30d13537
commit 2d1482b400
3 changed files with 3 additions and 8 deletions

View File

@ -1186,12 +1186,12 @@ class Image(object):
""" """
Configures the image file loader so it returns a version of the Configures the image file loader so it returns a version of the
image that as closely as possible matches the given mode and image that as closely as possible matches the given mode and
size. For example, you can use this method to convert a color size. For example, you can use this method to convert a color
JPEG to greyscale while loading it, or to extract a 128x192 JPEG to greyscale while loading it, or to extract a 128x192
version from a PCD file. version from a PCD file.
Note that this method modifies the :py:class:`~PIL.Image.Image` object Note that this method modifies the :py:class:`~PIL.Image.Image` object
in place. If the image has already been loaded, this method has no in place. If the image has already been loaded, this method has no
effect. effect.
Note: This method is not implemented for most images. It is Note: This method is not implemented for most images. It is

View File

@ -119,11 +119,6 @@ class ImageFile(Image.Image):
if not self.mode or self.size[0] <= 0: if not self.mode or self.size[0] <= 0:
raise SyntaxError("not identified by this driver") raise SyntaxError("not identified by this driver")
def draft(self, mode, size):
"""Set draft mode"""
pass
def get_format_mimetype(self): def get_format_mimetype(self):
if self.custom_mimetype: if self.custom_mimetype:
return self.custom_mimetype return self.custom_mimetype

View File

@ -415,7 +415,7 @@ class JpegImageFile(ImageFile.ImageFile):
return return
d, e, o, a = self.tile[0] d, e, o, a = self.tile[0]
scale = 0 scale = 1
if a[0] == "RGB" and mode in ["L", "YCbCr"]: if a[0] == "RGB" and mode in ["L", "YCbCr"]:
self.mode = mode self.mode = mode