]> AND Private Git Repository - Cipher_code.git/commitdiff
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
new
authorRaphaël Couturier <raphael.couturier@univ-fcomte.fr>
Tue, 13 Jul 2021 19:20:34 +0000 (21:20 +0200)
committerRaphaël Couturier <raphael.couturier@univ-fcomte.fr>
Tue, 13 Jul 2021 19:20:34 +0000 (21:20 +0200)
measure_energy_iot/client_tcp4.py

index 0944d1e2ac95490e4d3c8236faa644b3b932750a..a070da9908e14acfe75dc4c9be47bd4ff2305dbd 100644 (file)
@@ -27,14 +27,14 @@ elapsed_time=0
 t = time.time()
 for i in range(nb_times):
     buf = BytesIO()
 t = time.time()
 for i in range(nb_times):
     buf = BytesIO()
-    im.save(buf, "JPEG", quality=quality)
+    im.save(buf, "BMP", quality=quality)
 
 elapsed_time += time.time() - t
 
 print("time in memory bmp",elapsed_time/nb_times)
 
 
 
 elapsed_time += time.time() - t
 
 print("time in memory bmp",elapsed_time/nb_times)
 
 
-
+"""
 im=Image.open("lena.jpg")
 
 elapsed_time=0
 im=Image.open("lena.jpg")
 
 elapsed_time=0
@@ -45,16 +45,18 @@ for i in range(nb_times):
 elapsed_time += time.time() - t
 
 print("time bmp",elapsed_time/nb_times)
 elapsed_time += time.time() - t
 
 print("time bmp",elapsed_time/nb_times)
-
+"""
 
 
 
 im=Image.open("lena.jpg")
 elapsed_time=0
 
 
 
 im=Image.open("lena.jpg")
 elapsed_time=0
+im.save("lena2.jpg",quality=quality)
 t = time.time()
 for i in range(nb_times):
 t = time.time()
 for i in range(nb_times):
-
-    im.save("lena2.jpg",quality=quality)
+    buf = BytesIO()
+    im.save(buf, "JPEG", quality=quality)
+    
 elapsed_time += time.time() - t
 
 print("time noscale jpg",elapsed_time/nb_times)
 elapsed_time += time.time() - t
 
 print("time noscale jpg",elapsed_time/nb_times)
@@ -62,10 +64,14 @@ print("time noscale jpg",elapsed_time/nb_times)
 
 
 elapsed_time=0
 
 
 elapsed_time=0
+im2=im.resize((256, 256))
+im2.save("lena3.jpg",quality=quality)
 t = time.time()
 for i in range(nb_times):
     im2=im.resize((256, 256))
 t = time.time()
 for i in range(nb_times):
     im2=im.resize((256, 256))
-    im2.save("lena3.jpg",quality=quality)
+    buf = BytesIO()
+    im2.save(buf, "JPEG", quality=quality)
+    
 elapsed_time += time.time() - t
 print("time resize + pil",elapsed_time/nb_times)
 
 elapsed_time += time.time() - t
 print("time resize + pil",elapsed_time/nb_times)