fix deallocation bug in Image<P>
respect the grid when computing darks