Le 22/08/2022 à 15:47, Oier Arcelus a écrit :

I have an image to be shown using pyqtgraph. For this I use a numpy 2D array, which has a many elements along axis 1, but less along axis 0. As a result, I obtain ImageView's with very high aspect ratio, and I would like to stretch it such that it fits to the original view of the window that its shown in the screen.

I cannot find any entries about this in the forum and any help about this would be greatly appreaciated.

Use (e.g.) PIL (Pillow...) and numpy, say:

*from PIL import Image
import numpy as np
img = Image.open('yourimage.png')

nimg = img.resize((200, 100))  # /for example/
nimg.show() # /or not./

tbl=np.array(nimg)*

This is all. Unless I misunderstood your problem. Do you need some specific interpolation policy? You don't even say what is the colour depth of your image, so I chose anything...

Jerzy Karczmarczuk



--
Cet e-mail a été vérifié par le logiciel antivirus d'Avast.
www.avast.com

--
You received this message because you are subscribed to the Google Groups 
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyqtgraph/e52fa3b9-9808-c431-fb31-49d248e8c547%40gmail.com.

Reply via email to