You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Taking a offscreen screenshot works just fine when saving it to a file. However, when you specify "asarray" parameter, transparency information is lost:
plotter.show(
mesh,
viewup='y',
).screenshot('./_screenshot.png') # works fine saving a PNG file
img = plotter.show(
mesh,
viewup='y',
).screenshot('./_screenshot.png', ararray=True) # returns 3-channel RGB image with no tranpsarency
The cause is in file.io.py here (starting from line 1822):
if asarray:
pd = w2if.GetOutput().GetPointData()
npdata = utils.vtk2numpy(pd.GetArray("ImageScalars"))
npdata = npdata[:, [0, 1, 2]] #### ----------- DISCARDING 4th channel --------- ########
ydim, xdim, _ = w2if.GetOutput().GetDimensions()
npdata = npdata.reshape([xdim, ydim, -1])
npdata = np.flip(npdata, axis=0)
return npdata
When the marked line is removed, everything works as supposed to.
The text was updated successfully, but these errors were encountered:
Taking a offscreen screenshot works just fine when saving it to a file. However, when you specify "asarray" parameter, transparency information is lost:
plotter.show(
mesh,
viewup='y',
).screenshot('./_screenshot.png') # works fine saving a PNG file
img = plotter.show(
mesh,
viewup='y',
).screenshot('./_screenshot.png', ararray=True) # returns 3-channel RGB image with no tranpsarency
The cause is in file.io.py here (starting from line 1822):
if asarray:
pd = w2if.GetOutput().GetPointData()
npdata = utils.vtk2numpy(pd.GetArray("ImageScalars"))
npdata = npdata[:, [0, 1, 2]] #### ----------- DISCARDING 4th channel --------- ########
ydim, xdim, _ = w2if.GetOutput().GetDimensions()
npdata = npdata.reshape([xdim, ydim, -1])
npdata = np.flip(npdata, axis=0)
return npdata
When the marked line is removed, everything works as supposed to.
The text was updated successfully, but these errors were encountered: