My export script should export all images that the user might have used as textures. I don't have problems collecting the images. I also don't have a problem emulating being in an image-editor. The only thing I couldn't figure out how to do is how I can export the picture in any format. Here is a codesnippet how far I have got so far.
images is a list of images to export and they are all part of bpy.data.images. imageEditorArea is an existing image area because else the script doesn't want to run for some reason. exportDir is the directoy where all the images should go.
At this point I remember you that the user should not be able to change the loaction because he chose the location where the files should go already when he executed my operator
prevImage = imageEditorArea.spaces[0].image # want to keep the users selected image around for image in images: imageEditorArea.spaces[0].image = image bpy.ops.image.save_as({'area': imageEditorArea}, # emulate an imageEditor 'INVOKE_DEFAULT', # invoke the operator copy=True, # make a copy of the image filepath=exportDir + image.name) # export it to this location imageEditorArea.spaces[0].image = prevImage # reset the image back to the original The problem now is that normally, when you don't hand over a path to export the images to, one can choose an outputformat (something like 'BMP', 'JPEG', etc...). I can't figure out how one could achieve this without opening the fileselector.