Trying to improve Lefteris' solution is too check if there is space available in the first place.
That way, you can ask the user what he wants to do "Cancel" or "Save (anyway)", and he knows he's saving a 3mb picture in a 2mb storage it's probably gonna fail.
Then he can free space if necessary ; always give the user choice & information, he knows better than you what's happening anyway.
According to this answer : https://stackoverflow.com/a/8036586/3603502
you can get the available disk space. Translate it in megabytes if necessary, compare with picture size, and if the difference is less than, say, 100x, show error message saying "are you sure". Then he can do it or not, and if it fails you can show error like Lefteris suggested. And I'll insist on what he said because he was right :
You should always manipulate files with error statements so you can come back with information if it fails for any reason. (and display to user if necessary).