diff --git a/.DS_Store b/.DS_Store index 10c246f..8b4a3f0 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/isv_project/.DS_Store b/image_project/.DS_Store similarity index 70% rename from isv_project/.DS_Store rename to image_project/.DS_Store index 8490518..7f3cea6 100644 Binary files a/isv_project/.DS_Store and b/image_project/.DS_Store differ diff --git a/isv_project/app/__init__.py b/image_project/image_project/__init__.py similarity index 100% rename from isv_project/app/__init__.py rename to image_project/image_project/__init__.py diff --git a/isv_project/isv_project/asgi.py b/image_project/image_project/asgi.py similarity index 71% rename from isv_project/isv_project/asgi.py rename to image_project/image_project/asgi.py index b420767..0d50d18 100644 --- a/isv_project/isv_project/asgi.py +++ b/image_project/image_project/asgi.py @@ -1,5 +1,5 @@ """ -ASGI config for isv_project project. +ASGI config for image_project project. It exposes the ASGI callable as a module-level variable named ``application``. @@ -11,6 +11,6 @@ import os from django.core.asgi import get_asgi_application -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "isv_project.settings") +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "image_project.settings") application = get_asgi_application() diff --git a/isv_project/isv_project/settings.py b/image_project/image_project/settings.py similarity index 88% rename from isv_project/isv_project/settings.py rename to image_project/image_project/settings.py index 958ff8d..3196c2d 100644 --- a/isv_project/isv_project/settings.py +++ b/image_project/image_project/settings.py @@ -1,5 +1,5 @@ """ -Django settings for isv_project project. +Django settings for image_project project. Generated by 'django-admin startproject' using Django 5.0.1. @@ -21,7 +21,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent # See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = "django-insecure-^itl7gk82f%j@beh(*s(ggncc6of200s&reksb8@02$g-bvxts" +SECRET_KEY = "django-insecure-*!^xcc^cs2vsw!dsr14$veqch@s*a2#r9!g#6e#z0ma+ye^c7=" # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True @@ -32,6 +32,7 @@ ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [ + "init_image.apps.InitImageConfig", "django.contrib.admin", "django.contrib.auth", "django.contrib.contenttypes", @@ -50,12 +51,12 @@ MIDDLEWARE = [ "django.middleware.clickjacking.XFrameOptionsMiddleware", ] -ROOT_URLCONF = "isv_project.urls" +ROOT_URLCONF = "image_project.urls" TEMPLATES = [ { "BACKEND": "django.template.backends.django.DjangoTemplates", - "DIRS": [os.path.join(BASE_DIR, './app/templates')], + "DIRS": [os.path.join(BASE_DIR, './init_image/templates')], "APP_DIRS": True, "OPTIONS": { "context_processors": [ @@ -68,7 +69,7 @@ TEMPLATES = [ }, ] -WSGI_APPLICATION = "isv_project.wsgi.application" +WSGI_APPLICATION = "image_project.wsgi.application" # Database @@ -122,3 +123,7 @@ STATIC_URL = "static/" # https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" + +# fotoblog/settings.py +MEDIA_URL = '/media/' +MEDIA_ROOT = os.path.join(BASE_DIR, 'media/') \ No newline at end of file diff --git a/isv_project/isv_project/urls.py b/image_project/image_project/urls.py similarity index 68% rename from isv_project/isv_project/urls.py rename to image_project/image_project/urls.py index 92f2784..7865269 100644 --- a/isv_project/isv_project/urls.py +++ b/image_project/image_project/urls.py @@ -1,5 +1,5 @@ """ -URL configuration for isv_project project. +URL configuration for image_project project. The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/5.0/topics/http/urls/ @@ -16,8 +16,14 @@ Including another URLconf """ from django.contrib import admin from django.urls import path, include +from django.conf import settings +from django.conf.urls.static import static urlpatterns = [ - path("app/", include("app.urls")), - path("admin/", admin.site.urls), + path("image/", include("init_image.urls")), + path("admin/", admin.site.urls), ] + +if settings.DEBUG: + urlpatterns += static( + settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) \ No newline at end of file diff --git a/isv_project/isv_project/wsgi.py b/image_project/image_project/wsgi.py similarity index 71% rename from isv_project/isv_project/wsgi.py rename to image_project/image_project/wsgi.py index 32b4d04..5c9c03d 100644 --- a/isv_project/isv_project/wsgi.py +++ b/image_project/image_project/wsgi.py @@ -1,5 +1,5 @@ """ -WSGI config for isv_project project. +WSGI config for image_project project. It exposes the WSGI callable as a module-level variable named ``application``. @@ -11,6 +11,6 @@ import os from django.core.wsgi import get_wsgi_application -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "isv_project.settings") +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "image_project.settings") application = get_wsgi_application() diff --git a/isv_project/app/.DS_Store b/image_project/init_image/.DS_Store similarity index 84% rename from isv_project/app/.DS_Store rename to image_project/init_image/.DS_Store index 9e2fc3e..cb15a96 100644 Binary files a/isv_project/app/.DS_Store and b/image_project/init_image/.DS_Store differ diff --git a/isv_project/app/migrations/__init__.py b/image_project/init_image/__init__.py similarity index 100% rename from isv_project/app/migrations/__init__.py rename to image_project/init_image/__init__.py diff --git a/isv_project/app/admin.py b/image_project/init_image/admin.py similarity index 100% rename from isv_project/app/admin.py rename to image_project/init_image/admin.py diff --git a/isv_project/app/apps.py b/image_project/init_image/apps.py similarity index 61% rename from isv_project/app/apps.py rename to image_project/init_image/apps.py index bcfe39b..141a073 100644 --- a/isv_project/app/apps.py +++ b/image_project/init_image/apps.py @@ -1,6 +1,6 @@ from django.apps import AppConfig -class AppConfig(AppConfig): +class InitImageConfig(AppConfig): default_auto_field = "django.db.models.BigAutoField" - name = "app" + name = "init_image" diff --git a/isv_project/isv_project/__init__.py b/image_project/init_image/migrations/__init__.py similarity index 100% rename from isv_project/isv_project/__init__.py rename to image_project/init_image/migrations/__init__.py diff --git a/isv_project/app/models.py b/image_project/init_image/models.py similarity index 100% rename from isv_project/app/models.py rename to image_project/init_image/models.py diff --git a/image_project/init_image/src/blend_images.py b/image_project/init_image/src/blend_images.py new file mode 100644 index 0000000..d222d26 --- /dev/null +++ b/image_project/init_image/src/blend_images.py @@ -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 + + diff --git a/image_project/init_image/src/convert_to_black_and_white.py b/image_project/init_image/src/convert_to_black_and_white.py new file mode 100644 index 0000000..d5b84bc --- /dev/null +++ b/image_project/init_image/src/convert_to_black_and_white.py @@ -0,0 +1,3 @@ +def convert_to_black_and_white(image): + grayscale_image = image.convert('1') + return grayscale_image \ No newline at end of file diff --git a/isv_project/app/src/convert_to_grayscale.py b/image_project/init_image/src/convert_to_grayscale.py similarity index 73% rename from isv_project/app/src/convert_to_grayscale.py rename to image_project/init_image/src/convert_to_grayscale.py index 444de8e..a617ab3 100644 --- a/isv_project/app/src/convert_to_grayscale.py +++ b/image_project/init_image/src/convert_to_grayscale.py @@ -1,4 +1,3 @@ def convert_to_grayscale(image): - grayscale_image = image.convert("L") return grayscale_image \ No newline at end of file diff --git a/image_project/init_image/src/create_gif.py b/image_project/init_image/src/create_gif.py new file mode 100644 index 0000000..93da90f --- /dev/null +++ b/image_project/init_image/src/create_gif.py @@ -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) diff --git a/image_project/init_image/src/display_image.py b/image_project/init_image/src/display_image.py new file mode 100644 index 0000000..cb897aa --- /dev/null +++ b/image_project/init_image/src/display_image.py @@ -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() \ No newline at end of file diff --git a/image_project/init_image/src/fusionner_horizontalement.py b/image_project/init_image/src/fusionner_horizontalement.py new file mode 100644 index 0000000..b21d473 --- /dev/null +++ b/image_project/init_image/src/fusionner_horizontalement.py @@ -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 diff --git a/image_project/init_image/src/fusionner_verticalement.py b/image_project/init_image/src/fusionner_verticalement.py new file mode 100644 index 0000000..82c58cb --- /dev/null +++ b/image_project/init_image/src/fusionner_verticalement.py @@ -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 diff --git a/isv_project/app/src/image_opener.py b/image_project/init_image/src/image_opener.py similarity index 100% rename from isv_project/app/src/image_opener.py rename to image_project/init_image/src/image_opener.py diff --git a/isv_project/app/src/resize_image.py b/image_project/init_image/src/resize_image.py similarity index 100% rename from isv_project/app/src/resize_image.py rename to image_project/init_image/src/resize_image.py diff --git a/isv_project/app/templates/.DS_Store b/image_project/init_image/templates/.DS_Store similarity index 81% rename from isv_project/app/templates/.DS_Store rename to image_project/init_image/templates/.DS_Store index db41a0f..4192802 100644 Binary files a/isv_project/app/templates/.DS_Store and b/image_project/init_image/templates/.DS_Store differ diff --git a/image_project/init_image/templates/init_image/align_horizontal.html b/image_project/init_image/templates/init_image/align_horizontal.html new file mode 100644 index 0000000..51fb721 --- /dev/null +++ b/image_project/init_image/templates/init_image/align_horizontal.html @@ -0,0 +1,62 @@ + + + + + + + Document + + + + + +
+
+ +
+
+ +
+

+ Your are in page alignement horizontal +

+ +
+
+ {% csrf_token %} +
+ + +
+
+ + +
+ +
+
+ {% if image_classique %} +
+ + + +
+ {% endif %} +
+ + + + + \ No newline at end of file diff --git a/image_project/init_image/templates/init_image/align_vertical.html b/image_project/init_image/templates/init_image/align_vertical.html new file mode 100644 index 0000000..e4e39d7 --- /dev/null +++ b/image_project/init_image/templates/init_image/align_vertical.html @@ -0,0 +1,62 @@ + + + + + + + Document + + + + + +
+
+ +
+
+ +
+

+ Your are in page alignement vertical +

+ +
+
+ {% csrf_token %} +
+ + +
+
+ + +
+ +
+
+ {% if image_classique %} +
+ + + +
+ {% endif %} +
+ + + + + \ No newline at end of file diff --git a/image_project/init_image/templates/init_image/animation.html b/image_project/init_image/templates/init_image/animation.html new file mode 100644 index 0000000..0fb582f --- /dev/null +++ b/image_project/init_image/templates/init_image/animation.html @@ -0,0 +1,67 @@ + + + + + + + Document + + + + + +
+
+ +
+
+ +
+

+ Your are in page animation +

+ +
+
+ {% csrf_token %} +
+ + +
+
+ + +
+
+ + +
+ +
+
+ + {% if image_classique %} +
+ + + +
+ {% endif %} +
+ + + + + \ No newline at end of file diff --git a/image_project/init_image/templates/init_image/black_white.html b/image_project/init_image/templates/init_image/black_white.html new file mode 100644 index 0000000..45b383b --- /dev/null +++ b/image_project/init_image/templates/init_image/black_white.html @@ -0,0 +1,58 @@ + + + + + + + Document + + + + + +
+
+ +
+
+ +
+

+ Your are in page black and white +

+ +
+
+ {% csrf_token %} +
+ + +
+ +
+
+ + {% if image_classique %} +
+ + +
+ {% endif %} +
+ + + + + \ No newline at end of file diff --git a/image_project/init_image/templates/init_image/fusion.html b/image_project/init_image/templates/init_image/fusion.html new file mode 100644 index 0000000..fd1d793 --- /dev/null +++ b/image_project/init_image/templates/init_image/fusion.html @@ -0,0 +1,62 @@ + + + + + + + Document + + + + + +
+
+ +
+
+ +
+

+ Your are in page fusion +

+ +
+
+ {% csrf_token %} +
+ + +
+
+ + +
+ +
+
+ {% if image_classique %} +
+ + + +
+ {% endif %} +
+ + + + + \ No newline at end of file diff --git a/image_project/init_image/templates/init_image/gray.html b/image_project/init_image/templates/init_image/gray.html new file mode 100644 index 0000000..65a61a3 --- /dev/null +++ b/image_project/init_image/templates/init_image/gray.html @@ -0,0 +1,58 @@ + + + + + + + Document + + + + + +
+
+ +
+
+ +
+

+ Your are in page gray +

+ +
+
+ {% csrf_token %} +
+ + +
+ +
+
+ + {% if image_classique %} +
+ + +
+ {% endif %} +
+ + + + + \ No newline at end of file diff --git a/image_project/init_image/templates/init_image/index.html b/image_project/init_image/templates/init_image/index.html new file mode 100644 index 0000000..66c4975 --- /dev/null +++ b/image_project/init_image/templates/init_image/index.html @@ -0,0 +1,37 @@ + + + + + + Document + + + + +
+
+ +
+
+ + + + + + \ No newline at end of file diff --git a/image_project/init_image/templates/init_image/resize.html b/image_project/init_image/templates/init_image/resize.html new file mode 100644 index 0000000..2f3b49b --- /dev/null +++ b/image_project/init_image/templates/init_image/resize.html @@ -0,0 +1,66 @@ + + + + + + + Document + + + + + +
+
+ +
+
+ +
+

+ Your are in page resize +

+ +
+
+ {% csrf_token %} +
+ + +
+
+ + +
+
+ + +
+ +
+
+ + {% if image_classique %} +
+ + +
+ {% endif %} +
+ + + + + \ No newline at end of file diff --git a/image_project/init_image/templates/init_image/traitement.html b/image_project/init_image/templates/init_image/traitement.html new file mode 100644 index 0000000..219c235 --- /dev/null +++ b/image_project/init_image/templates/init_image/traitement.html @@ -0,0 +1,22 @@ + + + + + + + + Document + + + + + + +

traitement

+
+ + + + + +
diff --git a/isv_project/app/tests.py b/image_project/init_image/tests.py similarity index 100% rename from isv_project/app/tests.py rename to image_project/init_image/tests.py diff --git a/image_project/init_image/urls.py b/image_project/init_image/urls.py new file mode 100644 index 0000000..94fe3b7 --- /dev/null +++ b/image_project/init_image/urls.py @@ -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"), +] \ No newline at end of file diff --git a/image_project/init_image/views.py b/image_project/init_image/views.py new file mode 100644 index 0000000..e354131 --- /dev/null +++ b/image_project/init_image/views.py @@ -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}) + diff --git a/isv_project/manage.py b/image_project/manage.py similarity index 88% rename from isv_project/manage.py rename to image_project/manage.py index 3a8c7b0..9ea91f0 100755 --- a/isv_project/manage.py +++ b/image_project/manage.py @@ -6,7 +6,7 @@ import sys def main(): """Run administrative tasks.""" - os.environ.setdefault("DJANGO_SETTINGS_MODULE", "isv_project.settings") + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "image_project.settings") try: from django.core.management import execute_from_command_line except ImportError as exc: diff --git a/image_project/media/image_classique.png b/image_project/media/image_classique.png new file mode 100644 index 0000000..49161da Binary files /dev/null and b/image_project/media/image_classique.png differ diff --git a/image_project/media/image_classique_1.png b/image_project/media/image_classique_1.png new file mode 100644 index 0000000..188585f Binary files /dev/null and b/image_project/media/image_classique_1.png differ diff --git a/image_project/media/image_classique_2.png b/image_project/media/image_classique_2.png new file mode 100644 index 0000000..12a370a Binary files /dev/null and b/image_project/media/image_classique_2.png differ diff --git a/image_project/media/image_fusion-horizontal.png b/image_project/media/image_fusion-horizontal.png new file mode 100644 index 0000000..0e99dbc Binary files /dev/null and b/image_project/media/image_fusion-horizontal.png differ diff --git a/image_project/media/image_fusion-vertical.png b/image_project/media/image_fusion-vertical.png new file mode 100644 index 0000000..a1e3394 Binary files /dev/null and b/image_project/media/image_fusion-vertical.png differ diff --git a/image_project/media/image_fusion.png b/image_project/media/image_fusion.png new file mode 100644 index 0000000..0ce42df Binary files /dev/null and b/image_project/media/image_fusion.png differ diff --git a/image_project/media/image_gray.png b/image_project/media/image_gray.png new file mode 100644 index 0000000..1cde23e Binary files /dev/null and b/image_project/media/image_gray.png differ diff --git a/image_project/media/image_noir-blanc.png b/image_project/media/image_noir-blanc.png new file mode 100644 index 0000000..b1c6723 Binary files /dev/null and b/image_project/media/image_noir-blanc.png differ diff --git a/image_project/media/image_resize.png b/image_project/media/image_resize.png new file mode 100644 index 0000000..48728d7 Binary files /dev/null and b/image_project/media/image_resize.png differ diff --git a/image_project/media/new_gif.gif b/image_project/media/new_gif.gif new file mode 100644 index 0000000..ebac734 Binary files /dev/null and b/image_project/media/new_gif.gif differ diff --git a/image_project/media/style.css b/image_project/media/style.css new file mode 100644 index 0000000..80dac08 --- /dev/null +++ b/image_project/media/style.css @@ -0,0 +1,3 @@ +.formulaire{ + +} \ No newline at end of file diff --git a/isv_project/app/src/blend_images.py b/isv_project/app/src/blend_images.py deleted file mode 100644 index ba96f53..0000000 --- a/isv_project/app/src/blend_images.py +++ /dev/null @@ -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 - diff --git a/isv_project/app/src/convert_to_black_and_white.py b/isv_project/app/src/convert_to_black_and_white.py deleted file mode 100644 index af3eed0..0000000 --- a/isv_project/app/src/convert_to_black_and_white.py +++ /dev/null @@ -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)) \ No newline at end of file diff --git a/isv_project/app/src/create_gif.py b/isv_project/app/src/create_gif.py deleted file mode 100644 index 81c81ac..0000000 --- a/isv_project/app/src/create_gif.py +++ /dev/null @@ -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) diff --git a/isv_project/app/src/display_image.py b/isv_project/app/src/display_image.py deleted file mode 100644 index 90679de..0000000 --- a/isv_project/app/src/display_image.py +++ /dev/null @@ -1,6 +0,0 @@ -import matplotlib.pyplot as plt - - -def show_image(image): - plt.imshow(image) - plt.show() \ No newline at end of file diff --git a/isv_project/app/src/fusionner_horizontalement.py b/isv_project/app/src/fusionner_horizontalement.py deleted file mode 100644 index 80ec0b5..0000000 --- a/isv_project/app/src/fusionner_horizontalement.py +++ /dev/null @@ -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 diff --git a/isv_project/app/src/fusionner_verticalement.py b/isv_project/app/src/fusionner_verticalement.py deleted file mode 100644 index a0622a4..0000000 --- a/isv_project/app/src/fusionner_verticalement.py +++ /dev/null @@ -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 \ No newline at end of file diff --git a/isv_project/app/templates/app/.DS_Store b/isv_project/app/templates/app/.DS_Store deleted file mode 100644 index 5cecfb0..0000000 Binary files a/isv_project/app/templates/app/.DS_Store and /dev/null differ diff --git a/isv_project/app/templates/app/index.html b/isv_project/app/templates/app/index.html deleted file mode 100644 index 3922319..0000000 --- a/isv_project/app/templates/app/index.html +++ /dev/null @@ -1,9 +0,0 @@ -{% if latest_question_list %} - -{% else %} -

No polls are available.

-{% endif %} \ No newline at end of file diff --git a/isv_project/app/urls.py b/isv_project/app/urls.py deleted file mode 100644 index 90fc5c2..0000000 --- a/isv_project/app/urls.py +++ /dev/null @@ -1,13 +0,0 @@ -from django.urls import path - -from . import views - -urlpatterns = [ - path("", views.index, name="index"), - # ex: /polls/5/ - path("/", views.detail, name="detail"), - # ex: /polls/5/results/ - path("/results/", views.results, name="results"), - # ex: /polls/5/vote/ - path("/vote/", views.vote, name="vote"), -] \ No newline at end of file diff --git a/isv_project/app/views.py b/isv_project/app/views.py deleted file mode 100644 index 1097a6c..0000000 --- a/isv_project/app/views.py +++ /dev/null @@ -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) \ No newline at end of file