From ee2395016a3988e49b55ec9ae5867d518e6e1120 Mon Sep 17 00:00:00 2001 From: Technoduck Date: Wed, 20 Nov 2024 15:16:45 -0500 Subject: [PATCH] newly rendered images are of the same size as the previous zoomed in ones --- app.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index 599591f..e931425 100644 --- a/app.py +++ b/app.py @@ -51,6 +51,7 @@ class renderedImageZoom: self.set_sun(90) self.fisheye = False self.curr_env = 0 + self.zoom_factor = 1 self.env_list = ["cont_clean","cont_avr","cont_poll","urban","desert","mar_clean","mar_poll","mar_tro","arctic","antarctic"] self.aerosol_window = aerosol_window @@ -316,11 +317,15 @@ class renderedImageZoom: else: self.image = skydome.renderFromCamera(self.coords,self.betaM,self.g,self.altitude,self.temperature,self.pressure,self.sunDir) self.img = Image.fromarray(self.image,mode="RGB") - self.tk_image = ImageTk.PhotoImage(width=256,height=256,image=self.img) + #self.tk_image = ImageTk.PhotoImage(width=256,height=256,image=self.img) #img = ImageTk.PhotoImage(Image.open("highpress_camera.png")) - self.canvas.create_image(0,0, anchor="nw", image=self.tk_image) + #self.canvas.create_image(0,0, anchor="nw", image=self.tk_image) + self.img = self.img.resize((int(self.img.width * self.zoom_factor), int(self.img.height * self.zoom_factor))) + self.tk_image = ImageTk.PhotoImage(self.img) + self.canvas.delete("all") + self.canvas.create_image(0, 0, anchor="nw", image=self.tk_image) def save_image(self): imageio.imwrite("./sunset_t{}_p{}_env_{}_alt{}_ang{}.png".format(self.temperature,self.pressure,self.env_list[self.curr_env],self.altitude @@ -329,12 +334,14 @@ class renderedImageZoom: def zoom_in(self, event=None): # Increase the image size by a factor (e.g., 1.2) + self.zoom_factor = self.zoom_factor *1.2 self.img = self.img.resize((int(self.img.width * 1.2), int(self.img.height * 1.2))) self.tk_image = ImageTk.PhotoImage(self.img) self.canvas.delete("all") self.canvas.create_image(0, 0, anchor="nw", image=self.tk_image) def zoom_out(self, event=None): + self.zoom_factor = self.zoom_factor*0.8 # Decrease the image size by a factor (e.g., 0.8) self.img = self.img.resize((int(self.img.width * 0.8), int(self.img.height * 0.8)))#,resampling) self.tk_image = ImageTk.PhotoImage(self.img)