2.8 Cycles save image through python turns it black

Hey folks, I’m not sure whether this is a 2.8 bug or due to how new I am with blender, but I have a script that ultimately bakes a normal map for an imported .fbx, which shows up fine, but the moment I save the image through python it becomes a complete black square both in the image editor and the exported file. However, if I use the Image dropdown menu and click save it saves perfectly.

I’ve tried different file types, and I’m sure the script it waiting for the bake to complete. Thanks in advance!

        img = bpy.data.images['Normal']
        img.filepath = 'C:/temp/normalexport.BMP'
        img.file_format = 'BMP'

I think you need img.filepath_raw.

You are f*cking awesome. I have no idea how I missed this.