Release the GIL while calling expensive surface and image functions.