Had a similar issue loading images from a phone gallery into app for an app gallery and this was a life saver spent a week trying to find out how to do this before finally stumbling upon this. Thanks a ton.
Someone give this man a medal.
I am working on an app with 3 layers of different resolutions. It was easy enough to display them one on top of another centered into GUI elements which stretch them, but then I spent days to figure out how to crop one of them in accordance to the aim made with the 2 others.
When I finaly found the correct solution this post came as a godsent for the final piece of the puzzle. I would have spent days and a lot of sanity to put all of this together correctly.
Deepest appreciation.