# Best way to “Save a Copy” of an image in Python? [duplicate]

I have an image (bpy.types.Image). I want to "Save a Copy" of the image, ie. save it to a specified file without modifying the image. I want to be able to specify the format to save as (eg. JPEG, PNG).

What's the best way to do this in Python?

• @Gorgious Yes (edited to clarify). – scurest Jan 12 at 9:22
• Do you want the image to be unpacked afterwards or it has to remain in blender memory as a packed data block ? Related : blender.stackexchange.com/questions/13407/… blender.stackexchange.com/questions/29123/… – Gorgious Jan 12 at 9:25
• Like I said, I want the image to remain unchanged. Like with "Image>Save a Copy". The question is has been marked as a dupe of does not answer that. – scurest Jan 12 at 16:26
• Added a "save as" answer to dupe list above. – batFINGER Jan 16 at 8:21