@ -1,6 +1,6 @@
|
|||||||
from django.apps import AppConfig
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
class AppConfig(AppConfig):
|
class InitImageConfig(AppConfig):
|
||||||
default_auto_field = "django.db.models.BigAutoField"
|
default_auto_field = "django.db.models.BigAutoField"
|
||||||
name = "app"
|
name = "init_image"
|
@ -0,0 +1,37 @@
|
|||||||
|
from PIL import Image
|
||||||
|
import numpy as np
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
def blend_images(img1, img2, blend_ratio, position):
|
||||||
|
new_img1 = img1
|
||||||
|
new_img2 = img2
|
||||||
|
|
||||||
|
if (np.asarray(img1).shape[-1] != np.asarray(img2).shape[-1]):
|
||||||
|
# On regarde si l'image 1 a le canal alpha, si oui on l'enlève
|
||||||
|
if (np.asarray(img1).shape[-1] == 4):
|
||||||
|
new_img1 = new_img1.convert("RGB")
|
||||||
|
else:
|
||||||
|
new_img2 = new_img2.convert("RGB")
|
||||||
|
|
||||||
|
the_new_img2 = img2
|
||||||
|
|
||||||
|
# Ajuster la position de l'image 2 en fonction de la position relative
|
||||||
|
x, y = position
|
||||||
|
x *= -1
|
||||||
|
y *= -1
|
||||||
|
|
||||||
|
the_new_img2 = the_new_img2.crop((x, y, x + new_img1.width, y + new_img1.height))
|
||||||
|
|
||||||
|
array1 = np.array(new_img1)
|
||||||
|
array2 = np.array(the_new_img2)
|
||||||
|
|
||||||
|
blended_array = np.round(array1 * blend_ratio + array2 * (1 - blend_ratio)).astype(np.uint8)
|
||||||
|
|
||||||
|
if blended_array.ndim == 2:
|
||||||
|
blended_array = np.expand_dims(blended_array, axis=2)
|
||||||
|
|
||||||
|
blended_img = Image.fromarray(blended_array, 'RGB')
|
||||||
|
|
||||||
|
return blended_img
|
||||||
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
|||||||
|
def convert_to_black_and_white(image):
|
||||||
|
grayscale_image = image.convert('1')
|
||||||
|
return grayscale_image
|
@ -1,4 +1,3 @@
|
|||||||
def convert_to_grayscale(image):
|
def convert_to_grayscale(image):
|
||||||
|
|
||||||
grayscale_image = image.convert("L")
|
grayscale_image = image.convert("L")
|
||||||
return grayscale_image
|
return grayscale_image
|
@ -0,0 +1,23 @@
|
|||||||
|
import imageio
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
from PIL import Image
|
||||||
|
from .resize_image import redimensionner_image
|
||||||
|
|
||||||
|
def creer_gif(tableau_images, duree):
|
||||||
|
gif = []
|
||||||
|
|
||||||
|
for img in tableau_images:
|
||||||
|
img_red = img
|
||||||
|
|
||||||
|
img_red = img_red.convert("RGB")
|
||||||
|
|
||||||
|
if (tableau_images[0].size[1] != img.size[1]):
|
||||||
|
nouvelle_largeur = int(img.size[0] * (tableau_images[0].size[1] / img.size[1]))
|
||||||
|
nouvelle_hauteur = tableau_images[0].size[1]
|
||||||
|
img_red = redimensionner_image(np.asarray(img), nouvelle_largeur, nouvelle_hauteur)
|
||||||
|
|
||||||
|
gif.append(img_red)
|
||||||
|
|
||||||
|
# Enregistrer le GIF // duree en ms
|
||||||
|
imageio.mimsave('media/new_gif.gif', gif, duration=duree, loop=0)
|
@ -0,0 +1,7 @@
|
|||||||
|
import matplotlib.pyplot as plt
|
||||||
|
from PIL import Image, ImageDraw
|
||||||
|
|
||||||
|
def show_image(image):
|
||||||
|
image = Image.open(image)
|
||||||
|
plt.imshow(image)
|
||||||
|
# plt.show()
|
@ -0,0 +1,17 @@
|
|||||||
|
from .resize_image import redimensionner_image
|
||||||
|
from PIL import Image
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
result = Image.new('RGB', (image1.width + image2_redimensionnee.width, image1.height))
|
||||||
|
result.paste(image1, (0, 0))
|
||||||
|
result.paste(image2_redimensionnee, (image1.width, 0))
|
||||||
|
|
||||||
|
return result
|
@ -0,0 +1,17 @@
|
|||||||
|
from .resize_image import redimensionner_image
|
||||||
|
from PIL import Image
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
def fusionner_verticalement(image1, image2):
|
||||||
|
image2_redimensionnee = image2
|
||||||
|
|
||||||
|
if (image1.size[0] != image2.size[0]):
|
||||||
|
nouvelle_largeur = image1.size[0]
|
||||||
|
nouvelle_hauteur = int(image2.size[1] * (image1.size[0] / image2.size[0]))
|
||||||
|
image2_redimensionnee = redimensionner_image(np.asarray(image2), nouvelle_largeur, nouvelle_hauteur)
|
||||||
|
|
||||||
|
result = Image.new('RGB', (image1.width, image1.height + image2_redimensionnee.height))
|
||||||
|
result.paste(image1, (0, 0))
|
||||||
|
result.paste(image2_redimensionnee, (0, image1.height))
|
||||||
|
|
||||||
|
return result
|
@ -0,0 +1,62 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Document</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet"
|
||||||
|
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<header class="d-flex justify-content-center py-3">
|
||||||
|
<ul class="nav nav-pills">
|
||||||
|
<li class="nav-item"><a href="./../" class="nav-link" aria-current="page">Home</a></li>
|
||||||
|
<li class="nav-item"><a href="./../black&white" class="nav-link" aria-current="page">B&W</a></li>
|
||||||
|
<li class="nav-item"><a href="./../gray" class="nav-link">Gray</a></li>
|
||||||
|
<li class="nav-item"><a href="./../resize" class="nav-link">Resize</a></li>
|
||||||
|
<li class="nav-item"><a href="./../align_v" class="nav-link">Align_V</a></li>
|
||||||
|
<li class="nav-item"><a href="./" class="nav-link">Align_H</a></li>
|
||||||
|
<li class="nav-item"><a href="./../fusion" class="nav-link">Fusion</a></li>
|
||||||
|
<li class="nav-item"><a href="./../animation" class="nav-link">Animation</a></li>
|
||||||
|
</ul>
|
||||||
|
</header>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container text-center">
|
||||||
|
<h1 class="mb-5">
|
||||||
|
Your are in page alignement horizontal
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<div class="d-flex justify-content-center mb-5">
|
||||||
|
<form class="border boder-1 border-black p-3 w-50" action="" method="post" enctype="multipart/form-data">
|
||||||
|
{% csrf_token %}
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="mb-2" for="image">Choississez une image</label>
|
||||||
|
<input type="file" id="image" name="image" accept="image/*">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="mb-2" for="image2">Choississez une image</label>
|
||||||
|
<input type="file" id="image2" name="image2" accept="image/*">
|
||||||
|
</div>
|
||||||
|
<input type="submit" class="btn btn-primary mt-3" value="Telecharger">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
{% if image_classique %}
|
||||||
|
<div class="w-full">
|
||||||
|
<img class="w-100 mb-5" src="../../media/image_classique_1.png">
|
||||||
|
<img class="w-100 mb-5" src="../../media/image_classique_2.png">
|
||||||
|
<img class="w-100" src="../../media/image_fusion-horizontal.png">
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"
|
||||||
|
integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL"
|
||||||
|
crossorigin="anonymous"></script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
@ -0,0 +1,62 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Document</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet"
|
||||||
|
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<header class="d-flex justify-content-center py-3">
|
||||||
|
<ul class="nav nav-pills">
|
||||||
|
<li class="nav-item"><a href="./../" class="nav-link" aria-current="page">Home</a></li>
|
||||||
|
<li class="nav-item"><a href="./../black&white" class="nav-link" aria-current="page">B&W</a></li>
|
||||||
|
<li class="nav-item"><a href="./../gray" class="nav-link">Gray</a></li>
|
||||||
|
<li class="nav-item"><a href="./../resize" class="nav-link">Resize</a></li>
|
||||||
|
<li class="nav-item"><a href="./" class="nav-link">Align_V</a></li>
|
||||||
|
<li class="nav-item"><a href="./../align_h" class="nav-link">Align_H</a></li>
|
||||||
|
<li class="nav-item"><a href="./../fusion" class="nav-link">Fusion</a></li>
|
||||||
|
<li class="nav-item"><a href="./../animation" class="nav-link">Animation</a></li>
|
||||||
|
</ul>
|
||||||
|
</header>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container text-center">
|
||||||
|
<h1 class="mb-5">
|
||||||
|
Your are in page alignement vertical
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<div class="d-flex justify-content-center mb-5">
|
||||||
|
<form class="border boder-1 border-black p-3 w-50" action="" method="post" enctype="multipart/form-data">
|
||||||
|
{% csrf_token %}
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="mb-2" for="image">Choississez une image</label>
|
||||||
|
<input type="file" id="image" name="image" accept="image/*">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="mb-2" for="image2">Choississez une image</label>
|
||||||
|
<input type="file" id="image2" name="image2" accept="image/*">
|
||||||
|
</div>
|
||||||
|
<input type="submit" class="btn btn-primary mt-3" value="Telecharger">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
{% if image_classique %}
|
||||||
|
<div class="w-full">
|
||||||
|
<img class="w-100 mb-5" src="../../media/image_classique_1.png">
|
||||||
|
<img class="w-100 mb-5" src="../../media/image_classique_2.png">
|
||||||
|
<img class="w-100" src="../../media/image_fusion-vertical.png">
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"
|
||||||
|
integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL"
|
||||||
|
crossorigin="anonymous"></script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
@ -0,0 +1,67 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Document</title>
|
||||||
|
<link rel="stylesheet" href="../../media/style.css">
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet"
|
||||||
|
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<header class="d-flex justify-content-center py-3">
|
||||||
|
<ul class="nav nav-pills">
|
||||||
|
<li class="nav-item"><a href="./../" class="nav-link" aria-current="page">Home</a></li>
|
||||||
|
<li class="nav-item"><a href="./../black&white" class="nav-link" aria-current="page">B&W</a></li>
|
||||||
|
<li class="nav-item"><a href="./../gray" class="nav-link">Gray</a></li>
|
||||||
|
<li class="nav-item"><a href="./../resize" class="nav-link">Resize</a></li>
|
||||||
|
<li class="nav-item"><a href="./../align_v" class="nav-link">Align_V</a></li>
|
||||||
|
<li class="nav-item"><a href="./../align_h" class="nav-link">Align_H</a></li>
|
||||||
|
<li class="nav-item"><a href="./../fusion" class="nav-link">Fusion</a></li>
|
||||||
|
<li class="nav-item"><a href="./" class="nav-link">Animation</a></li>
|
||||||
|
</ul>
|
||||||
|
</header>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container text-center">
|
||||||
|
<h1 class="mb-5">
|
||||||
|
Your are in page animation
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<div class="d-flex justify-content-center mb-5">
|
||||||
|
<form class="border boder-1 border-black p-3 w-50" action="" method="post" enctype="multipart/form-data">
|
||||||
|
{% csrf_token %}
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="mb-2" for="image">Choississez une image</label>
|
||||||
|
<input type="file" id="image" name="image" accept="image/*">
|
||||||
|
</div>
|
||||||
|
<div class="form-group mb-3">
|
||||||
|
<label class="mb-2" for="image2">Choississez une image</label>
|
||||||
|
<input type="file" id="image2" name="image2" accept="image/*">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="mb-2" for="duree">Durée en ms: </label>
|
||||||
|
<input type="text" id="duree" name="duree" accept="image/*">
|
||||||
|
</div>
|
||||||
|
<input type="submit" class="btn btn-primary mt-3" value="Telecharger">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% if image_classique %}
|
||||||
|
<div class="w-full">
|
||||||
|
<img class="w-100 mb-5" src="../../media/image_classique_1.png">
|
||||||
|
<img class="w-100 mb-5" src="../../media/image_classique_2.png">
|
||||||
|
<img class="w-100 mb-5" src="../../media/new_gif.gif">
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"
|
||||||
|
integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL"
|
||||||
|
crossorigin="anonymous"></script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
@ -0,0 +1,58 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Document</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet"
|
||||||
|
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<header class="d-flex justify-content-center py-3">
|
||||||
|
<ul class="nav nav-pills">
|
||||||
|
<li class="nav-item"><a href="./../" class="nav-link" aria-current="page">Home</a></li>
|
||||||
|
<li class="nav-item"><a href="./" class="nav-link" aria-current="page">B&W</a></li>
|
||||||
|
<li class="nav-item"><a href="./../gray" class="nav-link">Gray</a></li>
|
||||||
|
<li class="nav-item"><a href="./../resize" class="nav-link">Resize</a></li>
|
||||||
|
<li class="nav-item"><a href="./../align_v" class="nav-link">Align_V</a></li>
|
||||||
|
<li class="nav-item"><a href="./../align_h" class="nav-link">Align_H</a></li>
|
||||||
|
<li class="nav-item"><a href="./../fusion" class="nav-link">Fusion</a></li>
|
||||||
|
<li class="nav-item"><a href="./../animation" class="nav-link">Animation</a></li>
|
||||||
|
</ul>
|
||||||
|
</header>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container text-center">
|
||||||
|
<h1 class="mb-5">
|
||||||
|
Your are in page black and white
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<div class="d-flex justify-content-center mb-5">
|
||||||
|
<form class="border boder-1 border-black p-3 w-50" action="" method="post" enctype="multipart/form-data">
|
||||||
|
{% csrf_token %}
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="mb-2" for="image">Choississez une image</label>
|
||||||
|
<input type="file" id="image" name="image" accept="image/*">
|
||||||
|
</div>
|
||||||
|
<input type="submit" class="btn btn-primary mt-3" value="Telecharger">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% if image_classique %}
|
||||||
|
<div class="w-full">
|
||||||
|
<img class="w-100 mb-5" src="../../media/image_classique.png">
|
||||||
|
<img class="w-100" src="../../media/image_noir-blanc.png">
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"
|
||||||
|
integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL"
|
||||||
|
crossorigin="anonymous"></script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
@ -0,0 +1,62 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Document</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet"
|
||||||
|
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<header class="d-flex justify-content-center py-3">
|
||||||
|
<ul class="nav nav-pills">
|
||||||
|
<li class="nav-item"><a href="./../" class="nav-link" aria-current="page">Home</a></li>
|
||||||
|
<li class="nav-item"><a href="./../black&white" class="nav-link" aria-current="page">B&W</a></li>
|
||||||
|
<li class="nav-item"><a href="./../gray" class="nav-link">Gray</a></li>
|
||||||
|
<li class="nav-item"><a href="./../resize" class="nav-link">Resize</a></li>
|
||||||
|
<li class="nav-item"><a href="./../align_v" class="nav-link">Align_V</a></li>
|
||||||
|
<li class="nav-item"><a href="./../align_h" class="nav-link">Align_H</a></li>
|
||||||
|
<li class="nav-item"><a href="./" class="nav-link">Fusion</a></li>
|
||||||
|
<li class="nav-item"><a href="./../animation" class="nav-link">Animation</a></li>
|
||||||
|
</ul>
|
||||||
|
</header>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container text-center">
|
||||||
|
<h1 class="mb-5">
|
||||||
|
Your are in page fusion
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<div class="d-flex justify-content-center mb-5">
|
||||||
|
<form class="border boder-1 border-black p-3 w-50" action="" method="post" enctype="multipart/form-data">
|
||||||
|
{% csrf_token %}
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="mb-2" for="image">Choississez une image</label>
|
||||||
|
<input type="file" id="image" name="image" accept="image/*">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="mb-2" for="image2">Choississez une image</label>
|
||||||
|
<input type="file" id="image2" name="image2" accept="image/*">
|
||||||
|
</div>
|
||||||
|
<input type="submit" class="btn btn-primary mt-3" value="Telecharger">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
{% if image_classique %}
|
||||||
|
<div class="w-full">
|
||||||
|
<img class="w-100 mb-5" src="../../media/image_classique_1.png">
|
||||||
|
<img class="w-100 mb-5" src="../../media/image_classique_2.png">
|
||||||
|
<img class="w-100" src="../../media/image_fusion.png">
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"
|
||||||
|
integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL"
|
||||||
|
crossorigin="anonymous"></script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
@ -0,0 +1,58 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Document</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet"
|
||||||
|
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<header class="d-flex justify-content-center py-3">
|
||||||
|
<ul class="nav nav-pills">
|
||||||
|
<li class="nav-item"><a href="./../" class="nav-link" aria-current="page">Home</a></li>
|
||||||
|
<li class="nav-item"><a href="./../black&white" class="nav-link" aria-current="page">B&W</a></li>
|
||||||
|
<li class="nav-item"><a href="./" class="nav-link">Gray</a></li>
|
||||||
|
<li class="nav-item"><a href="./../resize" class="nav-link">Resize</a></li>
|
||||||
|
<li class="nav-item"><a href="./../align_v" class="nav-link">Align_V</a></li>
|
||||||
|
<li class="nav-item"><a href="./../align_h" class="nav-link">Align_H</a></li>
|
||||||
|
<li class="nav-item"><a href="./../fusion" class="nav-link">Fusion</a></li>
|
||||||
|
<li class="nav-item"><a href="./../animation" class="nav-link">Animation</a></li>
|
||||||
|
</ul>
|
||||||
|
</header>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container text-center">
|
||||||
|
<h1 class="mb-5">
|
||||||
|
Your are in page gray
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<div class="d-flex justify-content-center mb-5">
|
||||||
|
<form class="border boder-1 border-black p-3 w-50" action="" method="post" enctype="multipart/form-data">
|
||||||
|
{% csrf_token %}
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="mb-2" for="image">Choississez une image</label>
|
||||||
|
<input type="file" id="image" name="image" accept="image/*">
|
||||||
|
</div>
|
||||||
|
<input type="submit" class="btn btn-primary mt-3" value="Telecharger">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% if image_classique %}
|
||||||
|
<div class="w-full">
|
||||||
|
<img class="w-100 mb-5" src="../../media/image_classique.png">
|
||||||
|
<img class="w-100" src="../../media/image_gray.png">
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"
|
||||||
|
integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL"
|
||||||
|
crossorigin="anonymous"></script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
@ -0,0 +1,37 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Document</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<header class="d-flex justify-content-center py-3">
|
||||||
|
<ul class="nav nav-pills">
|
||||||
|
<li class="nav-item"><a href="./" class="nav-link" aria-current="page">Home</a></li>
|
||||||
|
<li class="nav-item"><a href="./black&white" class="nav-link" aria-current="page">B&W</a></li>
|
||||||
|
<li class="nav-item"><a href="./gray" class="nav-link">Gray</a></li>
|
||||||
|
<li class="nav-item"><a href="./resize" class="nav-link">Resize</a></li>
|
||||||
|
<li class="nav-item"><a href="./align_v" class="nav-link">Align_V</a></li>
|
||||||
|
<li class="nav-item"><a href="./align_h" class="nav-link">Align_H</a></li>
|
||||||
|
<li class="nav-item"><a href="./fusion" class="nav-link">Fusion</a></li>
|
||||||
|
<li class="nav-item"><a href="./animation" class="nav-link">Animation</a></li>
|
||||||
|
</ul>
|
||||||
|
</header>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
<!-- <form action="" method="post" enctype="multipart/form-data">
|
||||||
|
{% csrf_token %}
|
||||||
|
|
||||||
|
<label for="image">Choisir une image :</label>
|
||||||
|
<input type="file" id="image" name="image" accept="image/*">
|
||||||
|
|
||||||
|
<input type="submit" value="telecharger">
|
||||||
|
</form> -->
|
@ -0,0 +1,66 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Document</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet"
|
||||||
|
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<header class="d-flex justify-content-center py-3">
|
||||||
|
<ul class="nav nav-pills">
|
||||||
|
<li class="nav-item"><a href="./../" class="nav-link" aria-current="page">Home</a></li>
|
||||||
|
<li class="nav-item"><a href="./../black&white" class="nav-link" aria-current="page">B&W</a></li>
|
||||||
|
<li class="nav-item"><a href="./../gray" class="nav-link">Gray</a></li>
|
||||||
|
<li class="nav-item"><a href="./" class="nav-link">Resize</a></li>
|
||||||
|
<li class="nav-item"><a href="./../align_v" class="nav-link">Align_V</a></li>
|
||||||
|
<li class="nav-item"><a href="./../align_h" class="nav-link">Align_H</a></li>
|
||||||
|
<li class="nav-item"><a href="./../fusion" class="nav-link">Fusion</a></li>
|
||||||
|
<li class="nav-item"><a href="./../animation" class="nav-link">Animation</a></li>
|
||||||
|
</ul>
|
||||||
|
</header>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container text-center">
|
||||||
|
<h1 class="mb-5">
|
||||||
|
Your are in page resize
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<div class="d-flex justify-content-center mb-5">
|
||||||
|
<form class="border boder-1 border-black p-3 w-50" action="" method="post" enctype="multipart/form-data">
|
||||||
|
{% csrf_token %}
|
||||||
|
<div class="form-group mb-3">
|
||||||
|
<label class="mb-2" for="image">Choississez une image</label>
|
||||||
|
<input type="file" id="image" name="image" accept="image/*">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="mb-2" for="hauteur">Choississez une nouvelle hauteur</label>
|
||||||
|
<input type="text" id="hauteur" name="hauteur" accept="image/*">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="mb-2" for="largeur">Choississez une nouvelle largeur</label>
|
||||||
|
<input type="text" id="largeur" name="largeur" accept="image/*">
|
||||||
|
</div>
|
||||||
|
<input type="submit" class="btn btn-primary mt-3" value="Telecharger">
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% if image_classique %}
|
||||||
|
<div class="w-full">
|
||||||
|
<img class="w-100 mb-5" src="../../media/image_classique.png">
|
||||||
|
<img class="w-full" src="../../media/image_resize.png">
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"
|
||||||
|
integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL"
|
||||||
|
crossorigin="anonymous"></script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
@ -0,0 +1,22 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
|
||||||
|
<title>Document</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
<h1>traitement</h1>
|
||||||
|
<div class="container">
|
||||||
|
<img src="../media/image_classique.png">
|
||||||
|
<img src="../media/image_gray.png">
|
||||||
|
<img src="../media/image_noir-blanc.png">
|
||||||
|
<img src="../media/image_redimension.png">
|
||||||
|
<img src="../media/image_fusion_vertical.png">
|
||||||
|
</div>
|
@ -0,0 +1,14 @@
|
|||||||
|
from django.urls import path
|
||||||
|
from . import views
|
||||||
|
import init_image.views
|
||||||
|
|
||||||
|
urlpatterns = [
|
||||||
|
path("", views.upload_image, name="upload_image"),
|
||||||
|
path("gray/", views.page_gray, name="page_gray"),
|
||||||
|
path("black&white/", views.black_white, name="black_white"),
|
||||||
|
path("resize/", views.resize_picture, name="resize_picture"),
|
||||||
|
path("align_v/", views.alignement_vertical, name="alignement_vertical"),
|
||||||
|
path("align_h/", views.alignement_horizontal, name="alignement_horizontal"),
|
||||||
|
path("fusion/", views.fusion, name="fusion"),
|
||||||
|
path("animation/", views.animation, name="animation"),
|
||||||
|
]
|
@ -0,0 +1,160 @@
|
|||||||
|
import numpy as np
|
||||||
|
|
||||||
|
from django.shortcuts import render
|
||||||
|
|
||||||
|
from .src.blend_images import blend_images
|
||||||
|
from .src.image_opener import open_image
|
||||||
|
from .src.convert_to_grayscale import convert_to_grayscale
|
||||||
|
from .src.convert_to_black_and_white import convert_to_black_and_white
|
||||||
|
from .src.resize_image import redimensionner_image
|
||||||
|
from .src.fusionner_verticalement import fusionner_verticalement
|
||||||
|
from .src.fusionner_horizontalement import fusionner_horizontalement
|
||||||
|
from .src.create_gif import creer_gif
|
||||||
|
|
||||||
|
# Create your views here.
|
||||||
|
def upload_image(request):
|
||||||
|
if request.method == 'POST' and request.FILES:
|
||||||
|
image = request.FILES['image']
|
||||||
|
|
||||||
|
# ouvrir image
|
||||||
|
image_t = open_image(image)
|
||||||
|
image_t.save("media/image_classique.png")
|
||||||
|
return render(request, 'init_image/traitement.html')
|
||||||
|
|
||||||
|
return render(request, 'init_image/index.html')
|
||||||
|
|
||||||
|
def page_gray(request):
|
||||||
|
if request.method == 'POST' and request.FILES:
|
||||||
|
image = request.FILES['image']
|
||||||
|
|
||||||
|
# ouvrir image
|
||||||
|
image_t = open_image(image)
|
||||||
|
image_t.save("media/image_classique.png")
|
||||||
|
|
||||||
|
# 1. Transformation en noir et blanc
|
||||||
|
image_noir_blanc = convert_to_grayscale(image_t)
|
||||||
|
image_noir_blanc.save("media/image_gray.png")
|
||||||
|
|
||||||
|
return render(request, 'init_image/gray.html', context={"image_classique" : True})
|
||||||
|
|
||||||
|
return render(request, 'init_image/gray.html', context={"image_classique" : False})
|
||||||
|
|
||||||
|
def black_white(request):
|
||||||
|
if request.method == 'POST' and request.FILES:
|
||||||
|
image = request.FILES['image']
|
||||||
|
|
||||||
|
# ouvrir image
|
||||||
|
image_t = open_image(image)
|
||||||
|
image_t.save("media/image_classique.png")
|
||||||
|
|
||||||
|
# 1. Transformation en noir et blanc
|
||||||
|
image_noir_blanc = convert_to_black_and_white(image_t)
|
||||||
|
image_noir_blanc.save("media/image_noir-blanc.png")
|
||||||
|
|
||||||
|
return render(request, 'init_image/black_white.html', context={"image_classique" : True})
|
||||||
|
|
||||||
|
return render(request, 'init_image/black_white.html', context={"image_classique" : False})
|
||||||
|
|
||||||
|
def resize_picture(request):
|
||||||
|
if request.method == 'POST' and request.FILES:
|
||||||
|
image = request.FILES['image']
|
||||||
|
hauteur = int(request.POST['hauteur'])
|
||||||
|
largeur = int(request.POST['largeur'])
|
||||||
|
|
||||||
|
if(hauteur < 1 ):
|
||||||
|
hauteur = 100
|
||||||
|
if(largeur <1):
|
||||||
|
largeur = 100
|
||||||
|
|
||||||
|
# ouvrir image
|
||||||
|
image_t = open_image(image)
|
||||||
|
image_t.save("media/image_classique.png")
|
||||||
|
|
||||||
|
# 1. Transformation en noir et blanc
|
||||||
|
image_noir_blanc = redimensionner_image(np.asarray(image_t), hauteur, largeur)
|
||||||
|
image_noir_blanc.save("media/image_resize.png")
|
||||||
|
|
||||||
|
return render(request, 'init_image/resize.html', context={"image_classique" : True})
|
||||||
|
|
||||||
|
return render(request, 'init_image/resize.html', context={"image_classique" : False})
|
||||||
|
|
||||||
|
def alignement_vertical(request):
|
||||||
|
if request.method == 'POST' and request.FILES:
|
||||||
|
image = request.FILES['image']
|
||||||
|
image2 = request.FILES['image2']
|
||||||
|
|
||||||
|
# ouvrir image
|
||||||
|
image_t1 = open_image(image)
|
||||||
|
image_t1.save("media/image_classique_1.png")
|
||||||
|
|
||||||
|
image_t2 = open_image(image2)
|
||||||
|
image_t2.save("media/image_classique_2.png")
|
||||||
|
|
||||||
|
# 1. Transformation en noir et blanc
|
||||||
|
image_noir_blanc = fusionner_verticalement(image_t1, image_t2)
|
||||||
|
image_noir_blanc.save("media/image_fusion-vertical.png")
|
||||||
|
|
||||||
|
return render(request, 'init_image/align_vertical.html', context={"image_classique" : True})
|
||||||
|
|
||||||
|
return render(request, 'init_image/align_vertical.html', context={"image_classique" : False})
|
||||||
|
|
||||||
|
def alignement_horizontal(request):
|
||||||
|
if request.method == 'POST' and request.FILES:
|
||||||
|
image = request.FILES['image']
|
||||||
|
image2 = request.FILES['image2']
|
||||||
|
|
||||||
|
# ouvrir image
|
||||||
|
image_t1 = open_image(image)
|
||||||
|
image_t1.save("media/image_classique_1.png")
|
||||||
|
|
||||||
|
image_t2 = open_image(image2)
|
||||||
|
image_t2.save("media/image_classique_2.png")
|
||||||
|
|
||||||
|
# 1. Transformation en noir et blanc
|
||||||
|
image_noir_blanc = fusionner_horizontalement(image_t1, image_t2)
|
||||||
|
image_noir_blanc.save("media/image_fusion-horizontal.png")
|
||||||
|
|
||||||
|
return render(request, 'init_image/align_horizontal.html', context={"image_classique" : True})
|
||||||
|
|
||||||
|
return render(request, 'init_image/align_horizontal.html', context={"image_classique" : False})
|
||||||
|
|
||||||
|
def fusion(request):
|
||||||
|
if request.method == 'POST' and request.FILES:
|
||||||
|
image = request.FILES['image']
|
||||||
|
image2 = request.FILES['image2']
|
||||||
|
|
||||||
|
# ouvrir image
|
||||||
|
image_t1 = open_image(image)
|
||||||
|
image_t1.save("media/image_classique_1.png")
|
||||||
|
|
||||||
|
image_t2 = open_image(image2)
|
||||||
|
image_t2.save("media/image_classique_2.png")
|
||||||
|
|
||||||
|
# 1. Transformation en noir et blanc
|
||||||
|
image_noir_blanc = blend_images(image_t1, image_t2, 0.1, (1000,1000))
|
||||||
|
image_noir_blanc.save("media/image_fusion.png")
|
||||||
|
|
||||||
|
return render(request, 'init_image/fusion.html', context={"image_classique" : True})
|
||||||
|
|
||||||
|
return render(request, 'init_image/fusion.html', context={"image_classique" : False})
|
||||||
|
|
||||||
|
def animation(request):
|
||||||
|
if request.method == 'POST' and request.FILES:
|
||||||
|
image = request.FILES['image']
|
||||||
|
image2 = request.FILES['image2']
|
||||||
|
duree = int(request.POST['duree'])
|
||||||
|
|
||||||
|
# ouvrir image
|
||||||
|
image_t1 = open_image(image)
|
||||||
|
image_t1.save("media/image_classique_1.png")
|
||||||
|
|
||||||
|
image_t2 = open_image(image2)
|
||||||
|
image_t2.save("media/image_classique_2.png")
|
||||||
|
|
||||||
|
# 1. Transformation en noir et blanc
|
||||||
|
image_noir_blanc = creer_gif([image_t1, image_t2], duree)
|
||||||
|
|
||||||
|
return render(request, 'init_image/animation.html', context={"image_classique" : True})
|
||||||
|
|
||||||
|
return render(request, 'init_image/animation.html', context={"image_classique" : False})
|
||||||
|
|
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 252 KiB |
After Width: | Height: | Size: 251 KiB |
After Width: | Height: | Size: 230 KiB |
After Width: | Height: | Size: 310 KiB |
After Width: | Height: | Size: 217 KiB |
After Width: | Height: | Size: 63 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 7.3 KiB |
After Width: | Height: | Size: 348 KiB |
@ -0,0 +1,3 @@
|
|||||||
|
.formulaire{
|
||||||
|
|
||||||
|
}
|
@ -1,20 +0,0 @@
|
|||||||
from PIL import Image
|
|
||||||
import numpy as np
|
|
||||||
import matplotlib.pyplot as plt
|
|
||||||
|
|
||||||
def blend_images(img1, img2, blend_ratio):
|
|
||||||
|
|
||||||
img2 = img2.resize(img1.size)
|
|
||||||
|
|
||||||
array1 = np.array(img1)
|
|
||||||
array2 = np.array(img2)
|
|
||||||
|
|
||||||
blended_array = np.round(array1 * blend_ratio + array2 * (1 - blend_ratio)).astype(np.uint8)
|
|
||||||
|
|
||||||
if blended_array.ndim == 2:
|
|
||||||
blended_array = np.expand_dims(blended_array, axis=2)
|
|
||||||
|
|
||||||
blended_img = Image.fromarray(blended_array, 'RGB')
|
|
||||||
|
|
||||||
return blended_img
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
|||||||
def convert_to_black_and_white(image):
|
|
||||||
for x in range(image.width):
|
|
||||||
for y in range(image.height):
|
|
||||||
pixel_color = image.getpixel((x, y))
|
|
||||||
|
|
||||||
if pixel_color != (255, 255, 255):
|
|
||||||
image.putpixel((x, y), (0, 0, 0))
|
|
@ -1,11 +0,0 @@
|
|||||||
import imageio
|
|
||||||
from PIL import Image
|
|
||||||
|
|
||||||
def creer_gif(tableau_images, output_path, duree=0.5):
|
|
||||||
gif = []
|
|
||||||
|
|
||||||
for img in tableau_images:
|
|
||||||
gif.append(Image.fromarray(img))
|
|
||||||
|
|
||||||
# Enregistrer le GIF
|
|
||||||
imageio.mimsave(output_path, gif, duration=duree)
|
|
@ -1,6 +0,0 @@
|
|||||||
import matplotlib.pyplot as plt
|
|
||||||
|
|
||||||
|
|
||||||
def show_image(image):
|
|
||||||
plt.imshow(image)
|
|
||||||
plt.show()
|
|
@ -1,13 +0,0 @@
|
|||||||
from resize_image import redimensionner_image
|
|
||||||
from PIL import Image
|
|
||||||
|
|
||||||
def fusionner_horizontalement(image1, image2):
|
|
||||||
nouvelle_largeur = int(image2.size[0] * (image1.size[1] / image2.size[1]))
|
|
||||||
nouvelle_hauteur = image1.size[1]
|
|
||||||
image2_redimensionnee = redimensionner_image(image2, nouvelle_largeur, nouvelle_hauteur)
|
|
||||||
|
|
||||||
result = Image.new('RGB', (image1.width + image2_redimensionnee.width, image1.height))
|
|
||||||
result.paste(image1, (0, 0))
|
|
||||||
result.paste(image2_redimensionnee, (image1.width, 0))
|
|
||||||
|
|
||||||
return result
|
|
@ -1,14 +0,0 @@
|
|||||||
from resize_image import redimensionner_image
|
|
||||||
from PIL import Image
|
|
||||||
|
|
||||||
def fusionner_verticalement(image1, image2):
|
|
||||||
|
|
||||||
nouvelle_largeur = image1.size[0]
|
|
||||||
nouvelle_hauteur = int(image2.size[1] * (image1.size[0] / image2.size[0]))
|
|
||||||
image2_redimensionnee = redimensionner_image(image2, nouvelle_largeur, nouvelle_hauteur)
|
|
||||||
|
|
||||||
result = Image.new('RGB', (image1.width, image1.height + image2_redimensionnee.height))
|
|
||||||
result.paste(image1, (0, 0))
|
|
||||||
result.paste(image2_redimensionnee, (0, image1.height))
|
|
||||||
|
|
||||||
return result
|
|
@ -1,9 +0,0 @@
|
|||||||
{% if latest_question_list %}
|
|
||||||
<ul>
|
|
||||||
{% for question in latest_question_list %}
|
|
||||||
<li><a href="/app/34/">34</a></li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
{% else %}
|
|
||||||
<p>No polls are available.</p>
|
|
||||||
{% endif %}
|
|
@ -1,13 +0,0 @@
|
|||||||
from django.urls import path
|
|
||||||
|
|
||||||
from . import views
|
|
||||||
|
|
||||||
urlpatterns = [
|
|
||||||
path("", views.index, name="index"),
|
|
||||||
# ex: /polls/5/
|
|
||||||
path("<int:question_id>/", views.detail, name="detail"),
|
|
||||||
# ex: /polls/5/results/
|
|
||||||
path("<int:question_id>/results/", views.results, name="results"),
|
|
||||||
# ex: /polls/5/vote/
|
|
||||||
path("<int:question_id>/vote/", views.vote, name="vote"),
|
|
||||||
]
|
|
@ -1,20 +0,0 @@
|
|||||||
from django.shortcuts import render
|
|
||||||
from django.http import HttpResponse
|
|
||||||
from django.template import loader
|
|
||||||
|
|
||||||
|
|
||||||
# Create your views here.
|
|
||||||
def index(request):
|
|
||||||
context = {"latest_question_list": 'qui est elon musk'}
|
|
||||||
return render(request, "app/index.html", context)
|
|
||||||
#return HttpResponse("Hello, world. You're at the app index.")
|
|
||||||
|
|
||||||
def detail(request, question_id):
|
|
||||||
return HttpResponse("You're looking at question %s." % question_id)
|
|
||||||
|
|
||||||
def results(request, question_id):
|
|
||||||
response = "You're looking at the results of question %s."
|
|
||||||
return HttpResponse(response % question_id)
|
|
||||||
|
|
||||||
def vote(request, question_id):
|
|
||||||
return HttpResponse("You're voting on question %s." % question_id)
|
|