Bug 1065877: prevent OOMs when editing, picking and sharing large images

If it doesn't we will already have thrown an exception at line 962