I'm making an add-on that does some calculations based on the image you have open in the image editor. Due to the fact that you can have multiple image editors open at a time with different images, it would be great to be able to say "Get image in the current editor."

How would I go about doing this? I'm pretty experienced with python and programming in general, but a complete noob at writing Blender add-ons

  • 1
    $\begingroup$ i think there is no "current editor". Only one where the mouse cursor is "over". $\endgroup$
    – Chris
    Commented Jun 25, 2021 at 3:09

1 Answer 1


Context.area returns the area in context (and its attributes). Test using the python console:

>>> C.area

>>> C.area.     

>>> C.area.type

Get the active space of the Image Editor and use SpaceImageEditor.image (in this case the same for all spaces). Example based on the Operator Simple template. Run the script, in the Image Editor press F3 and type "Simple Image...":

import bpy

class SimpleOperator(bpy.types.Operator):
    bl_idname = "image.simple_operator"
    bl_label = "Simple Image Editor Operator"

    def poll(cls, context):
        return context.area.type == 'IMAGE_EDITOR'

    def execute(self, context):
        image = context.area.spaces.active.image
        if image:
            # print (dir(image)) # Print all image attributes
            self.report({'INFO'}, "{}, {}".format(image.name, image.filepath))
            self.report({'INFO'}, "No active image")
        return {'FINISHED'}

def register():

def unregister():

if __name__ == "__main__":

Related: Active image of UV/Image Editor


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .