When saving the grid positions use absolute sizes instead of percentages. This is better because not all scanned images are the same size (due to the scan region being set manually) but all images have the same resolution. Furthermore save the grid settings just before changing images and load them after. This has the effect of recaculating the fractional sizes for the new image size.