I don't think this is the correct way to calculate the DPI, with this approach we will have same value everytime.