hasemrentals.blogg.se

How to make an entire image larger pyxel edit
How to make an entire image larger pyxel edit









how to make an entire image larger pyxel edit

I have created function for calling resize a single time with methods after et after cancel def on_resize(self, evt): See the following screenshot: Step 4: Click OK.

how to make an entire image larger pyxel edit

Step 4: Now enter the height and width under the Size section. Step 3: Format Pictures dialog box pops up, click the Size category in the left bar. Image = self.image_copy.resize((_width(),_height())) Step 2: Right click the selected picture, and select the Format Object item in the context menu. Self.label = tk.Label(self.canvas, image = self.background) Self.background = ImageTk.PhotoImage(self.background_image) Self.background_image = Image.open('image_file.PNG') Using _width(),_height() instead of 'event' makes he adjustment to size much quicker. Just sugesting a slight change in the answer. This is how it works using Lenna image as example: Self.image = self.img_copy.resize((new_width, new_height)) Self.background = Label(self, image=self.background_image) Self.background_image = ImageTk.PhotoImage(self.image) Self.image = Image.open("./resource/Background.gif") This is example application that uses Pillow to resize image on the Label as the label changes size: from tkinter import * Not sure if there is a way of doing this in tkinter? Or if perhaps I would write my own function that resizes the image according to the window size, however the image needs to resize relatively smoothly and quickly if the user resizes the window at any point. The centering functionality is already there, I just need the resize functionality.Ĭurrently what I have is: from tkinter import *īackground_image = PhotoImage(file="Background.gif")īackground = Label(root, image=background_image, bd=0) In a 400x900 window, the image does not resize, and centers itself horizontally.In a 500x400 window, the image resizes to 500x500, and still centers itself vertically.In a 800x400 window, the image does not resize, and centers itself vertically.Is there a way of resizing the image so that if the largest of the width and height of the window is smaller than the image, the image is adjusted to that size, keeping aspect ratio. However when the window is smaller than the image in width and height, it puts the center of the image in the center of the window, so you don't see the whole image, and it looks a little odd. The image is placed over the background, and if the window is wider than it is tall, the image centers itself in the middle over the black background, and it all looks very nice. I have a square background image, which fades to black around the edges, and then the main window has a black background. Trying to set up a background for my tkinter window.











How to make an entire image larger pyxel edit