the gain image now takes the offset image into account