How to set the image operators work on?

When exporting my mesh, I want to copy all texture images used by the mesh to the destination folder, images packed in the .blend file included. I’m on 2.58a.

First of all, how do I tell oprations such as bpy.ops.image.save_as() which image they should work on? I understand that I have to set it via the context somehow but I don’t know how. The API docs list bpy.context.edit_image but Blender complains that it doesn’t know that.

Thank you.

any particular reason for sticking with 2.57? soon there will be official 2.59

maybe mess around with


bpy.data.images['you_image_name']

do a dir() or autocomplete on that for options available in 2.57

I’m on 2.58a actually, thanks for pointing out!

Ok I ran print( dir(bpy.data.images) ), but the output is not very helpful at least not to me:

[‘bool’, ‘contains’, ‘delattr’, ‘doc’, ‘getattribute’, ‘getitem’, ‘iter’, ‘len’, ‘setattr’, ‘foreach_get’, ‘foreach_set’, ‘get’, ‘items’, ‘keys’, ‘load’, ‘new’, ‘remove’, ‘rna_type’, ‘tag’, ‘values’]

print(dir(bpy.data.images['your_image_name']))

or to simply print info about the first image

print(dir(bpy.data.images[0]))