python-imaging-library

Python Tkinter Images Tearing On Scroll

Python Tkinter Images Tearing On Scroll Question: I’m working on a project to create a GUI application to display images as clickable buttons in Tkinter. I have the functionality completed where the images appear in a scroll-able grid on the GUI. However, when scrolling up or down there is terrible screen tearing with the images. …

Total answers: 3

what is the use-case of Python3 only `if` and `break` in `for`?

what is the use-case of Python3 only `if` and `break` in `for`? Question: I am learning python but https://github.com/python-pillow/Pillow/blob/main/src/PIL/JpegImagePlugin.py#L435-L437 https://github.com/python-pillow/Pillow/blob/31669013d420c2a532f5be6c5631827fe36e6f70/src/PIL/JpegImagePlugin.py#L435-L437 I am watching the code of PIL of python then I can not understand here. for s in [8, 4, 2, 1]: if scale >= s: break Is the PIL library wrong? I did: watch …

Total answers: 1

Filling a cloud 2D image into a continous map

Filling a cloud 2D image into a continous map Question: I have the following image: and I wish to obtain something close to (I didn’t do it perfectly): How can I do this with python? My initial image is a 2D numpy array of 0 and 255 values. Asked By: Learning from masters || Source …

Total answers: 2

Tkinter: App.on_select() missing 1 required positional argument: 'event'

Tkinter: App.on_select() missing 1 required positional argument: 'event' Question: I am trying to develop a Python application whose goal is to display a certain picture depending of the selected value in a ComboBox. Unluckily the script displays the following error: return self.func(*args) ^^^^^^^^^^^^^^^^ TypeError: RadianceGBA.on_select() missing 1 required positional argument: ‘event’ Here is the code …

Total answers: 1

Why do image size differ when vertical vs horizontal?

Why do image size differ when vertical vs horizontal? Question: Tried to create a random image with PIL as per the example: import numpy from PIL import image a = numpy.random.rand(48,84) img = Image.fromarray(a.astype(‘uint8’)).convert(‘1’) print(len(img.tobytes())) This particular code will output 528. Wen we flip the numbers of the numpy array: a = numpy.random.rand(84,48) The output …

Total answers: 1

How to update an image on a tkinter button after edditing it with PILLOW

How to update an image on a tkinter button after edditing it with PILLOW Question: I am trying to work on a tkinter application that takes uploaded images and add a watermark to them and I am facing challenge rendering the newly watermarked image. Here is my code, I am trying to get the ‘add_watermark()’ …

Total answers: 1

How to manually increase Brightness in Pillow np.ndarray

How to manually increase Brightness in Pillow np.ndarray Question: Im trying to make an Image Editor in Python using tkinter. I’ve developped functions to manipulate images, increasing brightness, contrast and so on. I’ve been getting really wierd results when converting the array back to a Pillow Image using Image.fromarray() I know there are built in …

Total answers: 1

How would I read a raw RGBA4444 image using Pillow?

How would I read a raw RGBA4444 image using Pillow? Question: I’m trying to read a ‘.waltex’ image, which is a ‘walaber image’. It’s basically just in raw image format. The problem is, it uses ‘RGBA8888’, ‘RGBA4444’, ‘RGB565’ and ‘RGB5551’ (all of which can be determined from the header), and I could not find a …

Total answers: 2