Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
27 views

OSError When Saving Barcode in Roaming Folder After Converting Python Script to Executable on Windows

I'm having trouble saving a barcode image to the Roaming folder when I convert my Python script to an executable using PyInstaller on Windows. The script works fine during development, but after ...
JosephMoraila's user avatar
0 votes
0 answers
31 views

auto generating thumbnails from images with pillow and bytesIO i django

I've been trying to automatically generate thumbnails from images that I upload to the admin console in Django (I'm using drf). I want to be able to generate thumbnails for images that I upload when ...
Ajiri rkari iyelobu's user avatar
0 votes
0 answers
31 views

Incorrect bounding box with PIL text rendering

I am trying to render a custom font using PIL since tkinter doesn't support custom fonts. My approach is to load in the font, and then draw it on an image, and then size the image to be the same size ...
Minestone's user avatar
1 vote
1 answer
41 views

Creating a grid of n tiles so that the grid is approximately square

I have a variable amount of image tiles of specific dimensions that need to be fit into a grid. What is the best method of creating a grid that approximates a square the best? For example, if the ...
MrPakoras's user avatar
0 votes
0 answers
39 views

Python - PIL.save() issue - The fill character must be a unicode character, not bytes

I have some interesting issue with saving Image via PIL library. Aim: to change metadata like "Date Taken", "Creation Date" to pictures from picture name (name is standardize by ...
Jan Vaško's user avatar
0 votes
0 answers
10 views

ImageTk module fails

I'm trying to use the pillow package for Python in my Visual Studio Code IDE But it seems like the ImageTk module is not working properly. Every time I run the script it tells me that there is an ...
SROCO's user avatar
  • 1
0 votes
0 answers
23 views

After rotating the image, a black background appears instead of a transparent background, which prevents these images from being overlaid normally

I wrote a Python program with Pillow to overlay a bunch of small images onto one large one. There was an adequate overlay, in which the transparent color did not replace the previous superimposed ...
Limaximy's user avatar
1 vote
0 answers
126 views

ModuleNotFoundError: No module named 'PIL' while I installed this package

Traceback(most recent call last): File "c:\Users\AlarmTran\nifti2dicom-main\nifti2dicom-main\main.py", line 11, in <module> import PIL ModuleNotFoundError: No module named 'PIL' ...
Lam Tran's user avatar
0 votes
1 answer
44 views

Python: Using Pillow to convert any format to png, any way to speed the process up?

I'm currently working on an application that decompiles a PDF file into raw text, images, tables, etc... but I've encountered the problem where a lot of PDFs use a lot of different image formats, so I ...
Sereno's user avatar
  • 3
-1 votes
0 answers
268 views

Failed to build pillow pymunk ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects

I tried to download arcade, but for some reason it gives such an error, what can I do to fix it? Failed to build pillow pymunk ERROR: ERROR: Failed to build installable wheels for some pyproject.toml ...
soneoko's user avatar
0 votes
0 answers
22 views

Obtuse issues with bitmap derived screenshots

I have these functions in my program, which are supposed to take a screenshot of a specific application by copying its bitmap data and then crop that down to specific coordinates. Last night I was ...
Roland Deschain's user avatar
0 votes
0 answers
20 views

Why is my pywin32gui/PIL function not returning an image generated from a bitmap like I expect, but rather a completely black image?

I have this function in my code, which is supposed to generate a bitmap from an application and convert that to an image using Pillow. Whenever I save the output, though, it only returns a black image....
Roland Deschain's user avatar
0 votes
0 answers
23 views

How to Measure text width [duplicate]

I need to get the text width to precisely count each text word start point. I am creating some text animations with video background by ffmpeg library. To get animations with good quality I need to ...
Armen Sanoyan's user avatar
0 votes
1 answer
92 views

Convert Image under UV Light to RGB?

I have an Image (banknotes) as a dataset that is under UV Light. I want to image process it back to RGB again in order to detect which banknote is it (if it is 20, 50, 100 and so on bill) Since this ...
ANAXA GORAS's user avatar
0 votes
1 answer
70 views

Why image retrieval from SQLite database is failing

I am saving an image in the SQLite database with the code below: import sqlite3 import tkinter as tk from tkinter import filedialog from tkinter import messagebox from PIL import Image, ImageTk ...
pawan gogoi's user avatar
2 votes
2 answers
59 views

Make image from uint8 RGB pixel data

I am trying to make a library related to RGB pixel data, but cannot seem to save the image data correctly. That is my output image. This is my code: pixelmanager.py from PIL import Image import numpy ...
Kssonety's user avatar
0 votes
0 answers
24 views

Django based website having error with Pillow after deployment to Heroku Server while I want to migrate. (DB = Postgresql)

I have deployed my website based on django to Heroku, and changed my database from sqlite3 to postgresql, and when i want to migrate having an error with Pillow. Asking to install Pillow for working ...
Muhammadsidik Ibrohimov's user avatar
0 votes
0 answers
25 views

Dependency in library is outdated, but when you change it it cannot redirect the new name of the dependency to the library

I want to use from torchvision import transforms but there's an error that says like this { "name": "ImportError", "message": "cannot import name 'Image' ...
RedSean's user avatar
  • 13
0 votes
0 answers
30 views

How can I alter truncated images so that they won't trigger a "cannot identify image file" error withPIL?

For some PNG images (all have sizes 50KB and below), this script fails: img = Image.open('path_to_img') img with the error UnidentifiedImageError: cannot identify image file I have looked up similar ...
Meggy's user avatar
  • 87
0 votes
1 answer
37 views

arr_to_image changes the grayscale images

When processing images, I encountered strange behavior when converting a PIL gray image to a NumPy array. Here is a small code that loads a gray image image. from keras.utils import img_to_array, ...
vrs's user avatar
  • 1
0 votes
1 answer
33 views

Create image fitted to text in python

Is there a canonical way in python to create a new image that fits exactly a given text in python? With pillow or something similar? Like I would for example do with ImageMagick: convert -font Calibri ...
Hans's user avatar
  • 113
0 votes
1 answer
42 views

Can't install Python Imaging Library "Pillow"

I have tried to install pillow library for my Django project it won't install. I have tried many times there are no specific answer for problem on internet. First Try Terminal Input: (venv) PS C:\...
Dulanga Dasanayake's user avatar
2 votes
1 answer
58 views

How to pass tkimage raw data to cv2 functions?

TLDR I am writing a video recorder with tkinter and cv2. How to pass tkimage raw data to cv2.VideoWriter, cv2.circle, and so on? Current approach I using a numpy array (self.data) as a middle man. But ...
cpicanco's user avatar
  • 274
0 votes
1 answer
61 views

how to use variables inside a u string

I'm writing a code that takes an Arabic text that contains dialects (You can think of it as special characters such as ö, å and ä) and writes it on an image. The way I found to display those dialects ...
Abdulmoty's user avatar
0 votes
1 answer
86 views

Import Pillow on Python 3.12.4 virtual environment on Ubuntu 24.04

I am running Python 3.12.4 in a virtual environment under Ubuntu 24.04. Pillow 10.4.0 installed without warnings using the command: python -m pip install pillow. However a script: from PIL import ...
Jonathan's user avatar
  • 2,817
-2 votes
1 answer
84 views

Need to resample or resize images in python

I have two images, want to resize these images as should be same imagedata(circles/text) with exact same pixel location of both images. The distance between objects should also be same of both images....
254Hasan's user avatar
0 votes
1 answer
63 views

Django- how to convert <class 'django.core.files.uploadedfile.InMemoryUploadedFile'> to an image?

I have a form that uploads an image to my view; the uploaded image type is: <class 'django.core.files.uploadedfile.InMemoryUploadedFile'> I want to process the image though; thus I need it in ...
Mohammed Baashar's user avatar
1 vote
1 answer
39 views

How to adjust and center font text based on available space

I am currently writing a program that prints certificates when a course is completed. The certificates are in .png format and I am using Pandas to read the name of the person from an Excel spreadsheet ...
Riff55's user avatar
  • 11
0 votes
1 answer
27 views

How do I show this thumbnail on Pillow?

I am learning to use Pillow. I am trying to display the thumbnail but don't know how. Here is my current code: img = Image.open('block.jpg') new = img.thumbnail((400,400),Image.Resampling.LANCZOS) I'...
Evan Huang's user avatar
1 vote
1 answer
55 views

Why does the picture change to a white area?

I had again a problem while coding my video editor... Here is a simplified code (the variables are in German language, don't wonder and feel free to ask if you don't understand something): from ...
Alex's user avatar
  • 7
0 votes
1 answer
53 views

AttributeError: property 'mode' of 'JpegImageFile' object has no setter

I'm getting an error: AttributeError: property 'mode' of 'JpegImageFile' object has no setter While trying to open an image using the Pillow library. My code: from pil import Image as pl my_img = pl....
Besmella Kazimy's user avatar
0 votes
0 answers
29 views

I use the win32print library to print on a thermal printer. I want to print images, but it does not print and does not give me any errors

from escpos import printer import tkinter as tk import win32print from PIL import Image, ImageWin,ImageOps hPrinter = win32print.OpenPrinter("XP-80") current_job = win32print....
Abdulrhman AlFeel's user avatar
0 votes
1 answer
64 views

Generating text images

I am generating images containing a specific text. There is no problem generating an image with text where all text tokens are from one font. I wanted to bold out some words randomly, which requires ...
Taha Magdy's user avatar
1 vote
1 answer
64 views

PIL Image in a ipywidgets Container widget

I have some PIL images coming from some library and am trying to understand what is going on with them. To do that, I compute some values, call the library, and look for the picture. The computed ...
Daria's user avatar
  • 178
0 votes
0 answers
35 views

Does Image.fromarray works only with numpy.array objects?

That's a simple question, but I'm using numpy for the first time so I'm quite confused. I think I understand the how should it works: my function named img_PILarray below creates an array object ...
gravy's user avatar
  • 1
0 votes
1 answer
39 views

How can you capture a screenshot of any window using Python on Wayland?

For context I have a PyQt5 widget with a single button that let's me select a region of the screen to capture. I can use pillow and mss to capture stuff on X11 like so def take_screenshot(self, x1, y1,...
Vanillaice's user avatar
0 votes
1 answer
30 views

TKinter places a strange white box on a displayed image

I am developing a GUI using TKinter that allows users to interactively set parameters that are used for processing some images. The GUI displays the image that is being analyzed so that users can see ...
mrfraud's user avatar
0 votes
0 answers
39 views

Emojis not rendering with colors

I am trying to add COLOR emojis onto images as overlay, but it seems like the emojis keep being rendered in black and white, and also transparent: This is what I'm currently working with: def ...
jet chua's user avatar
0 votes
1 answer
48 views

Error loading .jpg images in tkinter window using tk.PhotoImage

Question: I am working on a tkinter application where I need to display images in the GUI. While loading .png images works perfectly fine, I am encountering difficulties when attempting to load .jpg ...
Ahmed Alsayadi's user avatar
0 votes
1 answer
32 views

Image to radar values

I am trying to do similarly to the topic responded to in:RADAR image for dBZ values However, here I have a figure with different dimensions and a color palette that is not so simple. Legend: image: ...
Lucas Fagundes's user avatar
0 votes
0 answers
30 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(...
fabpub's user avatar
  • 51
0 votes
1 answer
33 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. ...
GabrielGodefroy's user avatar
1 vote
1 answer
24 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[...
ABDUL AZEEM ANSARI's user avatar
2 votes
1 answer
96 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. ...
user321627's user avatar
  • 2,504
0 votes
1 answer
74 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 ...
Paul's user avatar
  • 41
0 votes
1 answer
82 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:\...
VAN's user avatar
  • 3
0 votes
1 answer
56 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 ...
Peter Skeels's user avatar
1 vote
2 answers
104 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: ...
Runsva's user avatar
  • 627
0 votes
0 answers
54 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, ...
Mohamad Makkouk's user avatar
1 vote
1 answer
31 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 ...
J.Shim's user avatar
  • 81

1
2 3 4 5
203