from PySide2.QtGui import QImage # Load image file image = QImage('example.png') # Get image width width = image.width() # Print image width print(f"Image width: {width} pixels")
from PySide2.QtGui import QImage # Load image file image = QImage('example.png') # Set new image width new_width = 400 image.setWidth(new_width) # Print new image width print(f"New image width: {image.width()} pixels")Package Library: PySide2.QtGui