Image metadata: many technical improvements to embedding metadata

ExifTool is a godsend, no doubt, but there are still endless headaches
when trying to deal with the complexities of image metadata.

This commit is an attempt to bring PD's metadata embedding behavior in
line with official specs as humanly possible, even when converting
images between totally different formats (JPEG -> PNG, for example).

Metadata will now be preferentially stored in the most relevant format
for a given container.  Tags that cannot be converted to a supported
format will be dropped.  Tags custom-written by PD will always use the
preferred metadata format, as determined by new helper functions in the
master pdFormats class.

This new behavior should result in the best possible scenario for moving
images with metadata between different formats.