Did you try this code in practice? Image width and height do not equal bounds lat/lng, they depend on projected coordinates according to current zoom level.