Thank you Matti!
This is the solution I used finally: pil_im.save(“dummy.bmp”, dpi=(resolH, resolV)) but I would have been happy with a simple Opencv solution.
Your link is very interesting with a OpenCv solution but a solution that implies to modify the binary buffer. I hope that Opencv will offer this as a parameter for imwrite.