Skip to content

Commit

Permalink
Merge pull request #186 from alexwlchan/dependabot/pip/ruff-0.9.4
Browse files Browse the repository at this point in the history
Bump ruff from 0.9.3 to 0.9.4
  • Loading branch information
alexwlchan authored Feb 1, 2025
2 parents 0101703 + 792f304 commit 59b9e5f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
17 changes: 8 additions & 9 deletions images/squarify.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,25 @@
from PIL import Image


if __name__ == '__main__':
if __name__ == "__main__":
try:
path = Path(sys.argv[1])
except IndexError:
sys.exit(f"Usage: {__file__} IMAGE_PATH")

im = Image.open(path)

out_path = path.with_suffix(".square" + path.suffix)
assert out_path != path

if im.width == im.height:
print(path)
elif im.width > im.height:
left = (im.width - im.height) / 2
upper = 0
right = im.width - (im.width - im.height) / 2
lower = im.height

crop_im = im.crop((left, upper, right, lower))
crop_im.save(out_path)
print(out_path)
Expand All @@ -36,10 +36,9 @@
upper = (im.height - im.width) / 2
right = im.width
lower = im.height - (im.height - im.width) / 2

crop_im = im.crop((left, upper, right, lower))
crop_im.save(out_path)
print(out_path)


# main()

# main()
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ python-multipart==0.0.6
# via asgi-csrf
pyyaml==6.0.1
# via datasette
ruff==0.9.3
ruff==0.9.4
# via -r requirements.in
s3transfer==0.10.2
# via boto3
Expand Down

0 comments on commit 59b9e5f

Please sign in to comment.