According to this page
https://docs.blender.org/api/current/bpy.context.html
there are only two possible values for "Image Context": edit_image and edit_mask. And the first one worked for me.
bpy.ops.image.invert({'edit_image': bpy.data.images['texture_name']}, invert_r=True, invert_g=True, invert_b=True))
Or the currently recommended way (without a deprecation warning):
with bpy.context.temp_override(**{'edit_image': bpy.data.images['texture_name']}):
bpy.ops.image.invert(invert_r=True, invert_g=True, invert_b=True)
Probably, the same technique can be used with other image operators, and edit_image allows us to "select" an image we want to edit.
with bpy.context.temp_override(edit_image=bpy.data.images['texture_name']):does the same thing – Gorgious Feb 02 '23 at 17:53