newly rendered images are of the same size as the previous zoomed in ones
This commit is contained in:
parent
10ead4e3a8
commit
ee2395016a
1 changed files with 9 additions and 2 deletions
11
app.py
11
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)
|
||||
|
|
Loading…
Reference in a new issue