0
$\begingroup$

How could I load an external image and display it in Image Editor automatically? Basically the same as when rendering an image and displaying the Render Result.

I'm already able to load the image programatically. However, I don't get how to display the image in the Image Editor.

$\endgroup$
1
$\begingroup$

If the image editor is used in one of the visible areas of the current workspace, you can iterate through bpy.context.screen.areas to find the one with type IMAGE_EDITOR. The image that is shown in the editor can be set through the space of the area.

An image can be loaded through bpy.data.images.load().

import bpy


img = bpy.data.images["Render Result"]
# img = bpy.data.images.load(filepath)

for area in bpy.context.screen.areas:
    if area.type == 'IMAGE_EDITOR':
        area.spaces.active.image = img
| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.