Also, the first one declares two anonymous objects, while the second utilizes one that is referenced by a pointer variable, 'r'.
Use the first method if you're not going to be using those objects again. Use the second method if you are.
Note that, because I only need to create a File object for the sole purpose of reading in the image, I use an anonymous object.
Otherwise, if the File were to have some future use, I would have created the File before, set it equal to a variable, and then used it in the read() method.
If you're not sure whether you're going to use an object again, it's best to simply assign it a pointer variable and play it safe.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com