Skip to content

Rendering entire image #1681

@bsobhani

Description

@bsobhani

If I run the following code,

from PIL import Image
import pyqtgraph as pg
import pyqtgraph.exporters
from PyQt5.QtWidgets import QApplication
import numpy as np
from scipy.ndimage import rotate


app = QApplication.instance()

image = Image.open("cameraman.png")

array = np.asarray(image)
im = pg.ImageView(view=pg.PlotItem())
im.show()
im.setImage(array)
im.getImageItem().rotate(30)

I get this image:

rotated_image

Since I rotated the image by 30 degrees, the corners in the above image were cut off. What I am trying to get is a numpy array of the entire image, with the corners in tact, but still rotated. I essentially want a numpy array of the image that I would get if I pressed the "view all" button. I also only want the image and not the xy axes or histogram, etc. Is there a way to access this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    answered?Please let us know if there are further issues!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions