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
I have a 2D time series data which I want to animate, exporting only the image itself without extra background outside the image. Using canvas_only = False gets me part of the way there by removing any visible napari controls. But there is still lots of black background outside the image which is exported. Is there a way to remove the background entirely and only export the image in the video?
I can manually limit the background by adjusting the napari viewer so that the image itself is almost the only thing displayed and the amount of black background is limited. But I want to export the video programmatically without doing this.
I guess there is probably no reasonable way to do this and also support zooming/changing magnification. But it would be helpfully for time series data. Maybe the right approach is to programmatically adjust the napari display window aspect ratio/zoom to only display the image?
Hi @ptbrown1729 - your intuition about setting the window feels correct to me but I'm not immediately sure of the best way to do this in napari. I've asked a question over at image.sc (link above) and we should definitely add this as a feature when an answer is found!
Late to the party here, but I want to add one workaround for anyone else that stumbles on this issue.
If you're looking for an easy-ish way to make sure there's not lots of empty black background around your final animation, you can use either viewer.reset_view() at the beginning of your animation script, or set the viewer.camera.zoom and/or viewer.camera.angle.
I find that often gets me a good enough result, and is an easy thing to include at the start of animation scripts.
I have a 2D time series data which I want to animate, exporting only the image itself without extra background outside the image. Using
canvas_only = False
gets me part of the way there by removing any visible napari controls. But there is still lots of black background outside the image which is exported. Is there a way to remove the background entirely and only export the image in the video?I can manually limit the background by adjusting the napari viewer so that the image itself is almost the only thing displayed and the amount of black background is limited. But I want to export the video programmatically without doing this.
I guess there is probably no reasonable way to do this and also support zooming/changing magnification. But it would be helpfully for time series data. Maybe the right approach is to programmatically adjust the napari display window aspect ratio/zoom to only display the image?
Here is an example script:
The text was updated successfully, but these errors were encountered: