🐛 fix resize bug in align

main
HugoooR 1 year ago
parent 1ae08b2c51
commit 173126ce1f

@ -1,4 +1,3 @@
from .resize_image import redimensionner_image
from PIL import Image
import numpy as np
@ -6,9 +5,9 @@ def fusionner_horizontalement(image1, image2):
image2_redimensionnee = image2
if (image1.size[1] != image2.size[1]):
nouvelle_largeur = int(image2.size[0] * (image1.size[1] / image2.size[1]))
nouvelle_hauteur = image1.size[1]
image2_redimensionnee = redimensionner_image(np.asarray(image2), nouvelle_largeur, nouvelle_hauteur)
ratio = image2.height / image2.width
new_width = int(image1.height * ratio)
image2_redimensionnee = image2.resize((new_width, image1.height))
result = Image.new('RGB', (image1.width + image2_redimensionnee.width, image1.height))
result.paste(image1, (0, 0))

@ -1,4 +1,3 @@
from .resize_image import redimensionner_image
from PIL import Image
import numpy as np
@ -6,7 +5,10 @@ def fusionner_verticalement(image1, image2):
image2_redimensionnee = image2
if (image1.size[0] != image2.size[0]):
image2_redimensionnee = image2_redimensionnee.resize(image1.size)
ratio = image2.width / image2.height
new_height = int(image1.width / ratio)
image2_redimensionnee = image2.resize((image1.width, new_height))
result = Image.new('RGB', (image1.width, image1.height + image2_redimensionnee.height))
result.paste(image1, (0, 0))

Binary file not shown.

Before

Width:  |  Height:  |  Size: 327 KiB

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 MiB

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 MiB

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 327 KiB

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 213 KiB

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 MiB

After

Width:  |  Height:  |  Size: 11 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 MiB

After

Width:  |  Height:  |  Size: 6.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 314 KiB

After

Width:  |  Height:  |  Size: 1.1 MiB

Loading…
Cancel
Save