Fixed a bug with writing images.

When transforming the images, the type was always being set to JPEG. If an image was not a JPEG and could not be transformed into a JPEG (e.g. because it had a transparent element), this wou
ld cause an exception to be thrown. Now, it will write the transformed images in the same format as the original.

Closes #625
Merge branch 'ohmage-2.16' of github.com:ohmage/server