# How to get full file path to rendered image?

I need to get full, absolute path to the image that has been rendered. Unfortunately bpy.path.abspath() returns only the folder path and not the disk. Same with all the other path functions - no disk.

• Could it be something like os.path.abspath(os.path.join(bpy.path.abspath("//"), bpy.context.scene.render.filepath)). I'm just no sure of what you get with that function alone. – Flavio Aug 11 '14 at 14:14
• Your code appends the D disk to the path (probably because my Blender is running from D) instead of C, to which the render is saved (specifically to C:\tmp\render.png) – Val Aug 11 '14 at 14:43

There's a utility function:

frame_path()
RenderSettings.frame_path(frame=1)
Return the absolute path to the filename to be written for a given frame

scene = bpy.context.scene
path = scene.render.frame_path(scene.frame_current)

• Still not 100% correct. For some reason shows me a slightly different file name. My script generates a render filename and then puts it in bpy.context.scene.render.filepath (just before rendering). The name contains a "#" but when I call scene.render.frame_path(scene.frame_current), it changes the "#" to "1" for some reason. But at least, I guess, I can get the folder path (with the disk) and then manually append the filename. Will try that – Val Aug 12 '14 at 6:58
• Blender fills in '#' in the output filename with the frame number that was rendered. To get a specific file you will need to know the frame number that you are after. – sambler Aug 12 '14 at 7:05
• I only render one frame at a time (it's not an animation). The "#" has to be there as it is because the images will be later on fed to another application which requires this character in filename – Val Aug 12 '14 at 7:18
• OK, I got the absolute folder path from that scene.render.frame_path(scene.frame_current) and then managed to replace the filename with the one I'm generating and now I have the full, correct path! – Val Aug 12 '14 at 7:41