In a current project, I have a simple error: I created a 144 dpi image where it have to be 72 dpi.
I wasted my time seeking where the error lies and at last I found it !
I use a template image that I feed with other data and save it to disk. The result is a 144 pdi image !
After pulling my hair, drinking whiskey and other stuff, I finally found where the error lies.
The template file resolution is 144 dpi !!!
So, if you have troubles with generated images, check the template file resolution !
I have 25 template files to change their resolution (in the mean time, I set it in the code before saving the generated image).