Blender has a very irritating quirk in which it fails to save an image that you have painted on, when the .blend is saved. To fix this you have to remember to use "save as image", before you save the .blend. Is there anyway to automatically save the image when saving the .blend?


A script free solution(or a script that runs whenever I save, no matter which button/keyboard short cut.)would be of great value!

  • 1
    $\begingroup$ I guess you could write a script that saves image and then saves the blend file... $\endgroup$
    – user1853
    Jun 22, 2014 at 17:56
  • $\begingroup$ I was hoping for a script free solution, since I would have to remember to fire the script instead of the regular save function, which defeats the point. $\endgroup$ Jun 22, 2014 at 17:58
  • 1
    $\begingroup$ Theres a patch to do just this: developer.blender.org/D398 $\endgroup$
    – ideasman42
    Jun 23, 2014 at 5:51
  • $\begingroup$ @ideasman42 does that mean I have to build it myself? Is the patch going it release? $\endgroup$ Jun 23, 2014 at 15:00
  • 2
    $\begingroup$ @GiantCowFilms - not sure yet, the patch is more a test-case, even though it works OK. I'm not really happy with just adding more options. $\endgroup$
    – ideasman42
    Jun 25, 2014 at 4:35

1 Answer 1


This sample code will save external images before saving to .blend (overwrites the originals):

bl_info = {
    "name": "Auto-save external images",
    "author": "CoDEmanX",
    "version": (1, 0),
    "blender": (2, 67, 0),
    "location": "",
    "description": "Save image datablocks on saving .blend",
    "warning": "Works on external images only!",
    "wiki_url": "",
    "category": "System"}

import bpy

def save_external_images(dummy):
    for img in bpy.data.images:

def register():

def unregister():

if __name__ == "__main__":

Make sure you enable this addon by default!

It does not work on internal image datablocks, unless you extent above code to save to an external file or maybe pack internally.

  • $\begingroup$ > You can easily turn it into and addon. How is that done? $\endgroup$ Sep 12, 2014 at 20:23
  • $\begingroup$ It's covered here: blender.org/documentation/blender_python_api_2_71_release/…, but I did that for you (see my updated answer) $\endgroup$
    – CodeManX
    Sep 12, 2014 at 20:37
  • $\begingroup$ For some reason the script doesn't work as it is written above and gives error "RenderResult has no image data to be saved" or something like that. I suppose it tries to save Render Result as well when iterating through images. When I tried to make checking with "if img.is_dirty" inside the loop to iterate only through images with Asterisk it worked. It would be great to edit the code or append it so to make it working out of the box $\endgroup$
    – Mr Zak
    Apr 4, 2019 at 14:07

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.