Set JPEG compression for image.save()
The settings you are looking for are the scene's render settings. When you save an image it will by default use these settings as well. The quality (JPEG compression) parameter is under the scene's render image settings:

bpy.context.scene.render.image_settings.quality


However, an Image data object's normal save function ( bpy.data.images['MyImage'].save() ) will not use the scene's render settings. It uses the image format settings which relates to the image saving dialogue opened through the UV/Image Editor's UI.

So to save and take the render settings into account use the Image data object's save_render function:

img = bpy.data.images['MyImage']
img.save_render( filepath = img.filepath, scene = bpy.context.scene )


The filepath = img.filepath bit makes sure you save on the image's existing file path. The scene = bpy.context.scene makes sure you save with the current scene's render settings applied, including the compression or quality parameter.