- Unmount your sparse image
- Open Terminal
- hdiutil resize -size 40g iPhotoLibrary.sparseimage
- Mount your sparse image and load photos
After you do step 4 and look at the available size (command-i) you may ask your self why it is not reporting the size you requested. The reason is because 40g is actually (2^20) * 40 = 41,943,040 in base 2.
Hope you enjoyed.