Skip to content

Commit

Permalink
Use snake case
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Jun 14, 2023
1 parent f338f35 commit 7d97fa8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Tests/test_imageops.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,13 +404,13 @@ def check(orientation_im):
assert 0x0112 not in transposed_im.getexif()


def test_exif_transpose_inplace():
def test_exif_transpose_in_place():
with Image.open("Tests/images/orientation_rectangle.jpg") as im:
assert im.size == (2, 1)
assert im.getexif()[0x0112] == 8
expected = im.rotate(90, expand=True)

ImageOps.exif_transpose(im, inPlace=True)
ImageOps.exif_transpose(im, in_place=True)
assert im.size == (1, 2)
assert 0x0112 not in im.getexif()
assert_image_equal(im, expected)
Expand Down
12 changes: 6 additions & 6 deletions src/PIL/ImageOps.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,13 +576,13 @@ def solarize(image, threshold=128):
return _lut(image, lut)


def exif_transpose(image, *, inPlace=False):
def exif_transpose(image, *, in_place=False):
"""
If an image has an EXIF Orientation tag, other than 1, transpose the image
accordingly, and remove the orientation data.
:param image: The image to transpose.
:param inPlace: Boolean. Keyword-only argument.
:param in_place: Boolean. Keyword-only argument.
If ``True``, the original image is modified in-place, and ``None`` is returned.
If ``False`` (default), a new :py:class:`~PIL.Image.Image` object is returned
with the transposition applied. If there is no transposition, a copy of the
Expand All @@ -601,11 +601,11 @@ def exif_transpose(image, *, inPlace=False):
}.get(orientation)
if method is not None:
transposed_image = image.transpose(method)
if inPlace:
if in_place:
image.im = transposed_image.im
image.pyaccess = None
image._size = transposed_image._size
exif_image = image if inPlace else transposed_image
exif_image = image if in_place else transposed_image

exif = exif_image.getexif()
if ExifTags.Base.Orientation in exif:
Expand All @@ -622,7 +622,7 @@ def exif_transpose(image, *, inPlace=False):
exif_image.info["XML:com.adobe.xmp"] = re.sub(
pattern, "", exif_image.info["XML:com.adobe.xmp"]
)
if not inPlace:
if not in_place:
return transposed_image
elif not inPlace:
elif not in_place:
return image.copy()

0 comments on commit 7d97fa8

Please sign in to comment.