Questions tagged [python-imaging-library]
The Python Imaging Library (PIL) provides the Python language with a de-facto standard foundation for image work. PIL’s API is lightweight but semantically consistent; it furnishes a range of comfortably Pythonic tools throughout much of the imaging lexicon: processing, analysis, compression and codec abstraction, etc. – all of which builds upon a bespoke and readily extensible library structure.
python-imaging-library
10,108
questions
0
votes
0
answers
12
views
When saving WebP using PIL in Python, the last pixel (bottom-right) becomes black
Problem: When saving a sequence of images as a lossless WebP animation using PIL, the last pixel (bottom-right) becomes black.
from PIL import Image
for png_file in png_files:
image = Image.open(...
-1
votes
0
answers
27
views
In Python(PIL, EXIF data info), What's the meaning this key? (59932 → 0xEA1C) [closed]
I'm using PIL. I'm checking for cases that exif data has been modified. (DateTime)
So I use _getexif() method and get the EXIF datas.
The original photo does not have this key (59932), but the ...
0
votes
1
answer
17
views
When calling torchvision.transforms.Normalize and converting to PIL.Image, how are values above 1 handled?
Applying torchvision.Normalize should lead to values below 0 and above 1, and thus below 0 and 255 when switching to integer values.
However, when watching the values, this seems NOT to be the case. ...
-1
votes
0
answers
11
views
Why Image Pasting not working in Python using Image Module
from PIL import Image, ImageOps
import sys
list = ['jpg', 'jpeg', 'png']
before = sys.argv[1]
after = sys.argv[2]
if len(sys.argv) == 3:
if before[-3:] in list and after[-3:] in list and after[...
2
votes
1
answer
45
views
How to fit an image exactly inside an Excel cell using Python and XlsxWriter?
I'm working on a Python script that inserts images into Excel cells using the XlsxWriter library. My goal is to have each image fit precisely within its cell, without any overflow or unused space.
...
0
votes
1
answer
62
views
Reshape array to RGB array with missing values
I'm creating a tkinter user interface to display several images which a user will manipulate (translate and rotate) over each other. As the user is manipulating the images I need to calculate the new ...
-2
votes
0
answers
19
views
TensorFlow/Keras `load_img` Error: "Could not import PIL.Image"
I am facing an import error despite downloading the pillow module and yes I have uninstalled pillow despite that I am facing the error. Any idea how to fix it? https://i.sstatic.net/eAhcTExv.png
I am ...
0
votes
1
answer
52
views
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\User\\Downloads.png' in Python
Everything was going smoothly until I tried to use PIL, I have been stuck on this for a few days, so if you can help, it will be very good.
import PIL
from PIL import Image
fp = Image.open(r"C:\...
0
votes
1
answer
53
views
Drawing a circle around a png image using PIL
I am trying to put player headshots inside / mask a circle around.
However, I get a colour on the background rather than transparent. Does anyone have any idea how I might achieve this? PS. I don't ...
1
vote
2
answers
74
views
Save 16-bit PGM Image with Python PIL?
I am attempting to convert an image in PNG format to a 16-bit PGM format and save it using Python's PIL library. I'm using Python 3.12.4 in all examples shown.
Using the following test.png image:
...
0
votes
0
answers
47
views
How do I convert a big Tkinter window to a picture?
I am creating a dashboard, and I want to copy the window I created onto a PowerPoint presentation.
My problem with using Pillow or other modules is that they take only what's on the screen; however, ...
1
vote
1
answer
29
views
How to change rgb values using numpy where function in python
from PIL import Image
import numpy as np
target_file = r'D:\rgb_test\C\test.tga'
img = Image.open(target_file)
basePixel = np.array(img)
old_rgb_value = (255, 0, 0)
new_rgb_value = (57, 57, 57)
I ...
-1
votes
0
answers
144
views
DLL load failed while importing _imaging: The specified module could not be found
I had been working with python modules and libraries for a while now and I have encountered a very unusual error recently while importing modules such as matplotlib, seaborn library etc.
from ...
0
votes
0
answers
26
views
How can I remove the stroke radius from text generated using Python Pillow?
I want a stroke around the text, but when I use the built-in parameters of the text function, the border has rounded edges. I want the border to have sharp, cornered edges instead.
I want sharp edges ...
0
votes
0
answers
18
views
Can PIL.Image.thumbnail INCREASE an Images size? [duplicate]
I am using PIL.Image.thumbnail() to resize images whilst maintaining aspect ratio.
However I have noticed a rather annoying behaviour.
If the input image is already less than the provided WIDTH x ...