Fix resolution unit not properly set in JPEG export (#2516)
Fix resolution unit not properly set in JPEG export (#2516)

* Fix resolution unit not properly set in JPEG export

Bug description
-----------------
To give an indication of the physical dimensions (pixels per inch, pixels per mm,...) of the image we can set the "ResolutionUnit", "XResolution" and "YResolution" attributes in the image spec.
For instance for PNG and TIFF this works perfectly, for JPEG however the resolution unit is not properly written.

Root cause in the code
------------------------------
In jpegoutput.cpp in the open() function the "ResolutionUnit" attribute was read and set in the m_cinfo.density_unit entry. 
However this was overwritten by the jpeg_set_defaults(&m_cinfo) call. 

Fix explanation
-----------------
The resmeta_to_density() already contained the "XResolution" and "YResolution" code, but not yet the "ResolutionUnit" code.
So in this fix I moved that code into resmeta_to_density().

OpenImageIO/oiio,OpenImageIO/oiio,OpenImageIO/oiio,OpenImageIO/oiio,lgritz/oiio,lgritz/oiio,lgritz/oiio,lgritz/oiio