mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 17:24:31 +03:00
Line too long
This commit is contained in:
parent
c7d924fd85
commit
929f7397db
|
@ -425,21 +425,24 @@ class TestFileTiff(PillowTestCase):
|
|||
infile = "Tests/images/tiff_strip_raw.tif"
|
||||
im = Image.open(infile)
|
||||
|
||||
self.assert_image_equal_tofile(im, "Tests/images/tiff_adobe_deflate.png")
|
||||
self.assert_image_equal_tofile(im,
|
||||
"Tests/images/tiff_adobe_deflate.png")
|
||||
|
||||
def test_strip_planar_raw(self):
|
||||
# gdal_translate -of GTiff -co INTERLEAVE=BAND tiff_strip_raw.tif tiff_strip_planar_raw.tiff
|
||||
infile = "Tests/images/tiff_strip_planar_raw.tif"
|
||||
im = Image.open(infile)
|
||||
|
||||
self.assert_image_equal_tofile(im, "Tests/images/tiff_adobe_deflate.png")
|
||||
self.assert_image_equal_tofile(im,
|
||||
"Tests/images/tiff_adobe_deflate.png")
|
||||
|
||||
def test_strip_planar_raw_with_overviews(self):
|
||||
# gdaladdo tiff_strip_planar_raw2.tif 2 4 8 16
|
||||
infile = "Tests/images/tiff_strip_planar_raw_with_overviews.tif"
|
||||
im = Image.open(infile)
|
||||
|
||||
self.assert_image_equal_tofile(im, "Tests/images/tiff_adobe_deflate.png")
|
||||
self.assert_image_equal_tofile(im,
|
||||
"Tests/images/tiff_adobe_deflate.png")
|
||||
|
||||
def test_tiled_planar_raw(self):
|
||||
# gdal_translate -of GTiff -co TILED=YES -co BLOCKXSIZE=32 -co BLOCKYSIZE=32 -co INTERLEAVE=BAND \
|
||||
|
@ -447,7 +450,8 @@ class TestFileTiff(PillowTestCase):
|
|||
infile = "Tests/images/tiff_tiled_planar_raw.tif"
|
||||
im = Image.open(infile)
|
||||
|
||||
self.assert_image_equal_tofile(im, "Tests/images/tiff_adobe_deflate.png")
|
||||
self.assert_image_equal_tofile(im,
|
||||
"Tests/images/tiff_adobe_deflate.png")
|
||||
|
||||
def test_tiff_save_all(self):
|
||||
import io
|
||||
|
|
|
@ -20,7 +20,14 @@ has the following structure:
|
|||
{format_directory}
|
||||
{data}
|
||||
Where:
|
||||
{header} = { u32:magic, u32:version, u32:width, u32:height, u32:mipmap_count, u32:format_count }
|
||||
{header} = {
|
||||
u32:magic,
|
||||
u32:version,
|
||||
u32:width,
|
||||
u32:height,
|
||||
u32:mipmap_count,
|
||||
u32:format_count
|
||||
}
|
||||
|
||||
* The "magic" number is "FTEX".
|
||||
* "width" and "height" are the dimensions of the texture.
|
||||
|
|
|
@ -1047,7 +1047,8 @@ class Image(object):
|
|||
2 = fast octree
|
||||
3 = libimagequant
|
||||
:param kmeans: Integer
|
||||
:param palette: Quantize to the palette of given :py:class:`PIL.Image.Image`.
|
||||
:param palette: Quantize to the palette of given
|
||||
:py:class:`PIL.Image.Image`.
|
||||
:returns: A new image
|
||||
|
||||
"""
|
||||
|
@ -1773,11 +1774,10 @@ class Image(object):
|
|||
if self.mode in ("1", "P"):
|
||||
resample = NEAREST
|
||||
|
||||
if self.mode == 'LA':
|
||||
return self.convert('La').resize(size, resample, box).convert('LA')
|
||||
|
||||
if self.mode == 'RGBA':
|
||||
return self.convert('RGBa').resize(size, resample, box).convert('RGBA')
|
||||
if self.mode in ['LA', 'RGBA']:
|
||||
im = self.convert(self.mode[:-1]+'a')
|
||||
im = im.resize(size, resample, box)
|
||||
return im.convert(self.mode)
|
||||
|
||||
self.load()
|
||||
|
||||
|
@ -1849,7 +1849,8 @@ class Image(object):
|
|||
else:
|
||||
post_trans = translate
|
||||
if center is None:
|
||||
rotn_center = (w / 2.0, h / 2.0) # FIXME These should be rounded to ints?
|
||||
# FIXME These should be rounded to ints?
|
||||
rotn_center = (w / 2.0, h / 2.0)
|
||||
else:
|
||||
rotn_center = center
|
||||
|
||||
|
@ -1864,7 +1865,8 @@ class Image(object):
|
|||
return a*x + b*y + c, d*x + e*y + f
|
||||
|
||||
matrix[2], matrix[5] = transform(-rotn_center[0] - post_trans[0],
|
||||
-rotn_center[1] - post_trans[1], matrix)
|
||||
-rotn_center[1] - post_trans[1],
|
||||
matrix)
|
||||
matrix[2] += rotn_center[0]
|
||||
matrix[5] += rotn_center[1]
|
||||
|
||||
|
@ -1887,7 +1889,8 @@ class Image(object):
|
|||
matrix)
|
||||
w, h = nw, nh
|
||||
|
||||
return self.transform((w, h), AFFINE, matrix, resample, fillcolor=fillcolor)
|
||||
return self.transform((w, h), AFFINE, matrix, resample,
|
||||
fillcolor=fillcolor)
|
||||
|
||||
def save(self, fp, format=None, **params):
|
||||
"""
|
||||
|
@ -2154,8 +2157,8 @@ class Image(object):
|
|||
:param fill: If **method** is an
|
||||
:py:class:`~PIL.Image.ImageTransformHandler` object, this is one of
|
||||
the arguments passed to it. Otherwise, it is unused.
|
||||
:param fillcolor: Optional fill color for the area outside the transform
|
||||
in the output image.
|
||||
:param fillcolor: Optional fill color for the area outside the
|
||||
transform in the output image.
|
||||
:returns: An :py:class:`~PIL.Image.Image` object.
|
||||
"""
|
||||
|
||||
|
|
|
@ -406,7 +406,9 @@ def floodfill(image, xy, value, border=None, thresh=0):
|
|||
except (ValueError, IndexError):
|
||||
return # seed point outside image
|
||||
edge = {(x, y)}
|
||||
full_edge = set() # use a set to keep record of current and previous edge pixels to reduce memory consumption
|
||||
# use a set to keep record of current and previous edge pixels
|
||||
# to reduce memory consumption
|
||||
full_edge = set()
|
||||
while edge:
|
||||
new_edge = set()
|
||||
for (x, y) in edge: # 4 adjacent method
|
||||
|
|
|
@ -203,7 +203,7 @@ class FreeTypeFont(object):
|
|||
size=self.size if size is None else size,
|
||||
index=self.index if index is None else index,
|
||||
encoding=self.encoding if encoding is None else encoding,
|
||||
layout_engine=self.layout_engine if layout_engine is None else layout_engine
|
||||
layout_engine=layout_engine or self.layout_engine
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -441,7 +441,10 @@ def fit(image, size, method=Image.NEAREST, bleed=0.0, centering=(0.5, 0.5)):
|
|||
crop_left = bleed_pixels[0] + (live_size[0]-crop_width) * centering[0]
|
||||
crop_top = bleed_pixels[1] + (live_size[1]-crop_height) * centering[1]
|
||||
|
||||
crop = (crop_left, crop_top, crop_left + crop_width, crop_top + crop_height)
|
||||
crop = (
|
||||
crop_left, crop_top,
|
||||
crop_left + crop_width, crop_top + crop_height
|
||||
)
|
||||
|
||||
# resize the image and return it
|
||||
return image.resize(size, method, box=crop)
|
||||
|
|
|
@ -185,8 +185,8 @@ if qt_is_installed:
|
|||
An PIL image wrapper for Qt. This is a subclass of PyQt's QImage
|
||||
class.
|
||||
|
||||
:param im: A PIL Image object, or a file name (given either as Python
|
||||
string or a PyQt string object).
|
||||
:param im: A PIL Image object, or a file name (given either as
|
||||
Python string or a PyQt string object).
|
||||
"""
|
||||
im_data = _toqclass_helper(im)
|
||||
# must keep a reference, or Qt will crash!
|
||||
|
|
|
@ -32,7 +32,8 @@ def _accept(prefix):
|
|||
|
||||
if is_riff_file_format and is_webp_file and is_valid_vp8_mode:
|
||||
if not SUPPORTED:
|
||||
return "image file could not be identified because WEBP support not installed"
|
||||
return "image file could not be identified " \
|
||||
"because WEBP support not installed"
|
||||
return True
|
||||
|
||||
|
||||
|
@ -253,7 +254,8 @@ def _save_all(im, fp, filename):
|
|||
rawmode = ims.mode
|
||||
if ims.mode not in _VALID_WEBP_MODES:
|
||||
alpha = 'A' in ims.mode or 'a' in ims.mode \
|
||||
or (ims.mode == 'P' and 'A' in ims.im.getpalettemode())
|
||||
or (ims.mode == 'P' and
|
||||
'A' in ims.im.getpalettemode())
|
||||
rawmode = 'RGBA' if alpha else 'RGB'
|
||||
frame = ims.convert(rawmode)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user