updated outdated python elements
This commit is contained in:
parent
1834ddf7f9
commit
b2f84a46eb
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
""" Author: Hendrik Schutter, localhorst@mosad.xyz
|
""" Author: Hendrik Schutter, localhorst@mosad.xyz
|
||||||
Date of creation: 2022/01/22
|
Date of creation: 2022/01/22
|
||||||
Date of last modification: 2022/01/25
|
Date of last modification: 2022/08/25
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
@ -63,7 +63,7 @@ def zoom_at(img, crop_factor):
|
|||||||
image_width, image_height = img.size
|
image_width, image_height = img.size
|
||||||
img = img.crop((int(image_width/2) - int(image_width/crop_factor) / (crop_factor * 2), int(image_height/2) - int(image_height/crop_factor) / (crop_factor * 2),
|
img = img.crop((int(image_width/2) - int(image_width/crop_factor) / (crop_factor * 2), int(image_height/2) - int(image_height/crop_factor) / (crop_factor * 2),
|
||||||
int(image_width/2) + int(image_width/crop_factor) / (crop_factor * 2), int(image_height/2) + int(image_height/crop_factor) / (crop_factor * 2)))
|
int(image_width/2) + int(image_width/crop_factor) / (crop_factor * 2), int(image_height/2) + int(image_height/crop_factor) / (crop_factor * 2)))
|
||||||
return img.resize((int(image_width/crop_factor*2), int(image_height/crop_factor*2)), Image.LANCZOS)
|
return img.resize((int(image_width/crop_factor*2), int(image_height/crop_factor*2)), Image.Resampling.LANCZOS)
|
||||||
|
|
||||||
def create_collage(images_A, images_B, statistics, output_file):
|
def create_collage(images_A, images_B, statistics, output_file):
|
||||||
image_width, image_height = images_A[0].size
|
image_width, image_height = images_A[0].size
|
||||||
@ -112,7 +112,7 @@ def create_collage(images_A, images_B, statistics, output_file):
|
|||||||
cropped_image = zoom_at(images_A[i], crop_factor)
|
cropped_image = zoom_at(images_A[i], crop_factor)
|
||||||
cropped_image_with, _ = cropped_image.size
|
cropped_image_with, _ = cropped_image.size
|
||||||
output_image.paste(cropped_image, (int(x_offset/2) + image_width - cropped_image_with , y))
|
output_image.paste(cropped_image, (int(x_offset/2) + image_width - cropped_image_with , y))
|
||||||
cropped_image = zoom_at(images_B[i].transpose(PIL.Image.FLIP_LEFT_RIGHT), crop_factor)
|
cropped_image = zoom_at(images_B[i].transpose(PIL.Image.Transpose.FLIP_LEFT_RIGHT), crop_factor)
|
||||||
output_image.paste(cropped_image, (int(x_offset/2) + image_width, y))
|
output_image.paste(cropped_image, (int(x_offset/2) + image_width, y))
|
||||||
i += 1
|
i += 1
|
||||||
y += image_height
|
y += image_height
|
||||||
@ -182,4 +182,4 @@ def main() -> None:
|
|||||||
delete_temp_dir()
|
delete_temp_dir()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
Binary file not shown.
Before Width: | Height: | Size: 3.2 MiB |
Loading…
Reference in New Issue
Block a user