Fixed incorrect image density calculation