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.

Filter by
Sorted by
Tagged with
-3 votes
0 answers
25 views

How to adjust light balance/brightness of an Image in python cv2 [closed]

I want to adjust the image to achieve an effect similar to when you focus (or click) on a bright object, such as a lamp, causing everything else to appear darker on a phone.
oas333's user avatar
  • 95
0 votes
0 answers
24 views

_tkinter.TclError: image "pyimage1" doesn't exist with a login window

I made a code with several modules... a 'main2.py', an 'Appimage.py', a 'spe_widget.py', when I run the program from main2.py, everything works fine . I then wanted to add a connection window which ...
FBAB's user avatar
  • 47
0 votes
0 answers
35 views

Find Corner of Sliding Window in Python With Accuracy

I Want Find Corner of Sliding Window I Tried a lot of algorithm and project based on Python but none of them work perfectly here my code. import cv2 from matplotlib import pyplot as plt import numpy ...
MoriX Mehrdad's user avatar
0 votes
1 answer
18 views

Tensorboard: Trying to log RGB image. TypeError: Cannot handle this data type

I am trying to log an RGB image to Tensorboard. I made sure that my image is a numpy array with the shape (206,127,3). The values inside are numpy.uint8 with a range from 0-255. When I do: writer....
A-wels's user avatar
  • 77
1 vote
1 answer
21 views

Import a RGB array into a PIL image with fromarray

I have a RGB array that I would like to import in PIL with fromarray and save to disk: import numpy as np from PIL import Image from PIL.PngImagePlugin import PngInfo a = np.array([[[255, 0, 0], [0, ...
Basj's user avatar
  • 41.7k
1 vote
1 answer
18 views

Encounter an error when want to run sherloq on Ubuntu: ImportError: cannot import name 'convert_dict_qtables' from 'PIL.JpegImagePlugin'

I'm encountering an issue when trying to run Sherloq on Ubuntu, and I'd appreciate some guidance on resolving it. Here are the details: I've set up a virtual environment and cloned the Sherloq ...
Ramadhan Arif Hardijansyah's user avatar
0 votes
0 answers
18 views

Failed building wheel for Pillow while installing tkinterdesigner

I am trying to install tkdesigner and when I try to do that it gives me this error code: <string>:46: RuntimeWarning: Pillow 8.4.0 does not support Python 3.11 and does not provide ...
knecht's user avatar
  • 25
0 votes
1 answer
26 views

In PIL getting 'Image' object has no attribute 'merge' error message- Jupyter Notebook

Trying to complete change the colors of an image using the Image.split() function changing the r,g,b values then recombining them with .merge() I checked this post too Using Pillow image.merge, ...
Greg Waxman's user avatar
1 vote
1 answer
52 views

TclError: image "pyimage2" doesn't exist

Im trying to make tkinter popups with a image in them, a image from bytes. It works the first time, but when i try to make a second popup after clicking the first one away, it gives the error _tkinter....
uhm's user avatar
  • 23
-1 votes
2 answers
40 views

Python PIL .show() let me see the image ~20/30 secs, no more

image = Image.new(mode="RGB", size=(X,Y), color=(255,255,255)) image.show() It show the image but for 20/30 secs. Maybe a link to temporary files. Have I to change the tempt file deletion ? ...
Vadim Kashtanov's user avatar
-1 votes
0 answers
17 views

Centering the text properly in my python code for generating multiple png files from a given template

I want to create around 600 image files from the same template (basically chest numbers) and I don't know how so I wrote a code using ChatGPT. But it is not centred properly and after multiple ...
Stolonifer's user avatar
-1 votes
0 answers
21 views

Could not be located in dynamic link library torch vision python executable, Failed to load dynlib/dll

I'm trying to create an executable file from my Python project. I'm using PyInstaller when I want to run the .exe file but I got an error: And see the text error below: UserWarning: Failed to load ...
Anice Jahanjoo's user avatar
2 votes
1 answer
53 views

How do I get smooth text with pythons PIL?

In my Script I open a tiff image and have to paste some text on it in the bottom right corner with PIL. So far so good. But the quality of the text is unusable! The the text should be white. Instead ...
habsi's user avatar
  • 311
-2 votes
0 answers
20 views

GIF-reading issue. The pillow library stops working when I change the dictionary that it reads files from

I am trying to create a program that will display 3 gifs at a time with the Python Imaging Library. I got everything working with 3 gifs, but when I try to switch out 1 gif with another, I get errors ...
Jason Brickman's user avatar
0 votes
1 answer
55 views

How paint a pixel using click on a PIL image with tkinter

Im trying to paint a pixel on a PIL image on click, im using Tkinter to display the image and i can get the coordinates of the clicked pixel already, but i cant show the painted pixel on the screen ...
Coolhatena's user avatar
1 vote
1 answer
20 views

libpng - RGB color space not permitted on grayscale PNG when using images created by Pillow

I am trying to train a YOLOv8 detection model. Since I couldn't find a dataset that fits my project's purpose, I've decided to create my own dataset by overlaying images on top of a background image. ...
Robin Lee's user avatar
-1 votes
0 answers
31 views

Are the PIL Image.open function and fromarray function implemented in the C++ head file of src?

I'm trying to use PIL's functions Image.open and froamarray in C++, but I can't find the converted code. When I looked at git, I saw that there were several c files in the src directory and looked ...
K.Ricky's user avatar
  • 45
0 votes
0 answers
27 views

Rembg to removing backgroud of images in python not functioning

I am trying to remove background from images with Rembg but it doesn't remove the background . I have installed all the libraries needed to do it Rembg, Rembg[gpu], Rembg[cli], python version 3.11.5 ...
O JOE's user avatar
  • 587
-1 votes
1 answer
30 views

Python socket/client image sharing [closed]

I'm trying get screenshots and send it to server socket but unfortunately couldn't do that I checked videos and asked to ai but couldn't get a working solution. I will only write here the neccesarry ...
Kafası Güzel Penguen's user avatar
-1 votes
1 answer
60 views

Error Failed building wheel for pillow while installing on Windows

I'm trying to install Pillow on python 3.10 using command pip install Pillow and it occurs ERROR: Failed building wheel for Pillow below: (venv) PS C:\Users\Mohamad\PycharmProjects\faracode_project>...
Mohamad Ardebili's user avatar
-1 votes
0 answers
42 views

Make PDF from PNG images without losing quality

My folders filled with PNGs (lossless format) get converted into appropriate PDFs (one per folder) using this code. However, the resulting PDF image quality is much worse compared to the PNG files. ...
user02222022's user avatar
-1 votes
0 answers
43 views

Install Pillow into Ubuntu 22.04

I am trying to install Pillow into a venv on my Ubuntu 22.04 workstation. I use python 3.10.12 and pip 23.2.1 More details : I am using jupyter notebook through VS code my command : pip install Pillow ...
ahmedaao's user avatar
0 votes
1 answer
31 views

Python PIL error 'L' format requires 0 <= number <= 4294967295

I create a numpy array of int, then I transform it as a PIL Image of type uint32, and then I try to save it. See simple mock code below: import numpy resLabels = numpy.ndarray(shape=(38000, 38000), ...
FiReTiTi's user avatar
  • 5,637
0 votes
1 answer
26 views

Python PIL Trying to swap square pixel groups between two images

I have tried this code so much, and I cannot find where the error is (see code below.) The idea is to take two pictures of the same size and swap square groups of pixels between them, creating two ...
Jean-Paul Bardou's user avatar
0 votes
1 answer
33 views

Trying to change 2 images average pixel brightness to a middle value (between them) using PIL in python

I have 2 images, I have calculated the average pixel brightness for both, I have then calculated the midpoint between the average brightness and the factors necessary to modify each image to reach tis ...
Tom's user avatar
  • 1
1 vote
1 answer
54 views

Overlay effect on image in python Pillow

I am using python to get an overlay effect on an image on mouse click. How can I increase the transparency of the color so the underlying image remains visible. Currently the underlying image hides ...
pranav nerurkar's user avatar
-1 votes
0 answers
23 views

check transparency part of an image

I have to make sure that the image in a png represents a circle (transparent on the borders). The only non transparent pixels are within a circle. the image have a fixed size of 400x400 I tried using ...
MOUP POUM's user avatar
0 votes
0 answers
27 views

python pypdf2 pdf to text conversion

When I tried to create blank page I am getting this error new_page = PyPDF2.PageObject.create_blank_page( page_width, page_height) AttributeError: 'decimal.Decimal' object has no attribute 'pages' Why ...
Dhivakar Somasundaram's user avatar
0 votes
1 answer
39 views

decoding PDF: can I use PIL/Pillow to access the PNG predictor algorithm in order to reverse it for ingest to PIL?

I'm decoding PDF files using Python with reference to the 2008 spec: https://web.archive.org/web/20081203002256/https://www.adobe.com/devnet/acrobat/pdfs/PDF32000_2008.pdf particularly section 7.4.4.4....
Cameron Simpson's user avatar
1 vote
1 answer
74 views

In Python, how to insert PNG image converted from html WEBP to excel without saving image and appending images in local PC folder?

My target is scraping html data including sorted information and WEBP images and saving to Excel sheet. WEBP format images cannot be inserted to Excel sheet directly. The only way is converting WEBP ...
陳韋仲's user avatar
0 votes
1 answer
21 views

Automatically Re-Forcing Tkinter Canvas Fullscreen Image on Top (Windows 10, Python)

The goal is to show the image with no border, full screen, and keep its focus no matter what happens on the computer. The program shows an image in our lobby that clients occasionally see, so it is ...
javery's user avatar
  • 5
1 vote
1 answer
59 views

Is it possible to achieve negative X-Skewing without cropping in Python PIL?

Im working on to transform images using X-skew using the following code from PIL import Image def x_skew_image(input_path, output_path, skew_factor): # Open the input image input_image = ...
kal's user avatar
  • 13
-2 votes
0 answers
17 views

No-latin alphabets printing in pillow

I want to print a string using PIL with different intervals between characters (the value is parametr). There are syllabilic languages where in another cases independant letters can render as one ...
виктор ивнов's user avatar
0 votes
0 answers
22 views

Trying to match luminosity of images using Pillow Module in Python

I am trying to match the luminosity distribution of two folders. Each folder has 50 images, I am attempting to ensure that both folders luminosity's (saturation, brightness, contrast, hue) are the ...
Tom's user avatar
  • 1
1 vote
1 answer
52 views

Pydicom error while resizing dicom file - ValueError: The length of the pixel data in the dataset doesn't match the expected length

I am new to working with DICOM files. I want to resize a non-square DICOM image, e.g., 512 x 768 pixels and rescale it to 512 x 512 without either dimension being squashed or stretched. So this ...
Abhimanyu Anand's user avatar
0 votes
1 answer
13 views

why but line this is not displayed. PIL

the code is made in the PIl library under python I just want that but line can be displayed I did a test to see if the lines appeared but they are not why import sys from PIL import Image, ImageDraw ...
gytedopl's user avatar
0 votes
0 answers
14 views

Enhancing Color Detection Accuracy in Real-Time: Dealing with Gray Color Issues

I am working on a color detection project that works fine under normal conditions. However, when I attempt real-time detection, I'm noticing that it tends to detect more gray colors than the actual ...
dtovia's user avatar
  • 31
-1 votes
0 answers
56 views

OSError: no library called "cairo-2" was found - python AWS Lambda Layers package

I installed CairoSVG using pip install CairoSVG in path/python. Then, I zip the python folder, and upload it as a layer for my AWS Lambda function. But when I test my lambda function which uses the ...
zerotwo's user avatar
  • 19
-2 votes
1 answer
34 views

How merge image with python pillow into center of an another image? [closed]

I have two images. I want to merge one image into the other but it has to be perfectly in the middle? im1 = Image.open('image1.png') im2 = Image.open('image2.png') back_im = im1.copy() #location of ...
Daniel 's user avatar
  • 109
0 votes
1 answer
19 views

Python How to check if my PNG files contain 1 parts or multiple parts

I'm trying to code something that detect if my png files are only one part or contain multiple parts (has transparent between the parts). one part png 4 parts png I found some code online, but it ...
One boy's user avatar
  • 206
0 votes
1 answer
35 views

Pillow ImageDraw how to limit the size of the image based on text to be written in the image itself

I'm trying to create a single image that has a bit of padding above and below the text but no padding whatsoever (unless the user adds a blank space in the string). To my understanding I'd need to ...
Guilherme Theis's user avatar
0 votes
1 answer
49 views

Display photos and play associated audio with python & cap touch input

I am making what is essentially a "See and Say", but running on a Raspberry Pi. I am using an Adafruit MPR121 capacitive touch sensor to provide the "keyboard" input to control the ...
user3308886's user avatar
0 votes
1 answer
22 views

Why is it that when I try to overlay a PIL image onto another, both of which have the same size, they end up not aligning properly?

This is my test frame, I am trying to find which map it is by pasting every single map on top and checking if the images match. It is cut perfectly and the image I paste on top is also cut perfectly ...
Иван Йорданов's user avatar
0 votes
0 answers
43 views

Python garbage collector does not release images from memory when used with the Tkinter library

I'm relatively new to programming, I'm self-taught. I'm trying to create a program for sorting photos (using the keys that the user will select to move the photos to their pre-initialized folders). My ...
Anonyxl Her's user avatar
-1 votes
2 answers
60 views

Handing duplicates in a list in python [closed]

I'm trying to make a table of pixel colors using Python. This table has over 10,000 values and I want to render the images fast (it usually takes around 4 secs to render). Anyway, I want to handle ...
alek's user avatar
  • 3
0 votes
0 answers
10 views

expected multiple file output but only last one is saved

so I made this Python GUI program that started with a very simple function: using askfiledialog to input one image, enter the target size in MB, resize the image, output in askfiledialog again. I ...
pingusama's user avatar
0 votes
0 answers
12 views

Python PIL: Draw a series of connected arcs

Given a track definition in a format like ===------===+++===, (where = is a straight piece of track, and - and + are left- and right-winding curves respectively), I want to plot the course of railroad ...
2080's user avatar
  • 1,233
0 votes
1 answer
53 views

How can I turn distinct R G B arrays back into an image?

In Python: I read in an image and I want to process each channel (RGB) separately, then put the modified channels back together into an image and save it to disk. I have tried everything I can think ...
Geoff Horton's user avatar
0 votes
0 answers
25 views

Bounding box is misaligned after object detection by converting yolov5 to TFLite type & About obtaining labels

We converted yolov5 to TensorFlowLite type and created a program to perform object detection from images. However, when looking at the output image, all bounding boxes are displayed slightly lower to ...
sarada's user avatar
  • 11
0 votes
0 answers
39 views

Scanning receipts into a spreadsheet

I've been getting more strict with my budget and tracking my spending lately and I want to create an itemized spending tracker in a spreadsheet. i.e. instead of putting in a $50 grocery store receipt, ...
MaxAMilli's user avatar

1
2 3 4 5
199