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