How do I add a background image with cli

I want to add a background image to a docx file and save it using only a headless version of LibreOffice. I want to write a php script that uploads a docx file and “watermarks” it with a background image.

Any idea?

Do you want the result as docx or as odt?