If you want to change dpi for example for 96 dpi per inch you should use this method:
const double dpi = 96 / 0.0254;
img.setDotsPerMeterX(dpi);
img.setDotsPerMeterY(dpi);
If you want to change dpi for example for 96 dpi per inch you should use this method:
const double dpi = 96 / 0.0254;
img.setDotsPerMeterX(dpi);
img.setDotsPerMeterY(dpi);