How to write a python script that opens My_file.blend and applies a script on it?
Start with the basics

blender --background my.blend --python myscript.py


where myscript.py contains your logic and

bpy.ops.render.render(write_still=True)


To produce the render

in your script you can change just about anything e.g.

bpy.context.scene.render.image_settings.file_format='PNG'


Set the output filename

You can also pass parameters and include multiple python scripts.