Bug 116164

Summary: Cropped JPEG images get distorted when changing monitor resolution
Product: LibreOffice Reporter: robert_averbeck
Component: ImpressAssignee: Not Assigned <libreoffice-bugs>
Status: RESOLVED DUPLICATE    
Severity: normal CC: aron.budea, horst, ilmari.lauhakangas
Priority: medium    
Version: 5.4.5.1 release   
Hardware: All   
OS: All   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=112538
https://bugs.documentfoundation.org/show_bug.cgi?id=118299
Whiteboard:
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 116082    

Description robert_averbeck 2018-03-03 20:40:50 UTC
Description:
When importing a JPEG picture Impress will try to read the resolution (dpi, ppi) from the JFIF tag. If this tag is not present Impress will use the resolution of the current monitor instead. Since the odp file format uses length units (e.g. cm) when defining image cropping, the crop values of images without JFIF tag need to be changed when changing the monitor resolution, otherwise these images get distorted. Unfortunately most digital cameras do not use the JFIF tag but the IFD0 tag. Please note that using a machine dependent default makes odp documents machine dependent. This explains user complaints about image distortion when exchanging documents between different machines.

Steps to Reproduce:
1.Import a JPEG file from a digital camera into Impress.
2.Crop the image in one dimension and save the odp file.
3.Opening this file on a machine with different monitor resolution

Actual Results:  
Image is displayed (and printed) in correct size but distorted.

Expected Results:
odp files should be machine independent.


Reproducible: Always


User Profile Reset: Yes



Additional Info:
Suggest fix: When importing a JPEG image which does not have a JFIF tag, look for an IFD0 tag. If both tags are missing, use a constant (machine independent) default value for resolution. Any fix for this bug will change the display of some existing documents. Therefore, I suggest supplying a tool that prompts the user for a dpi value and converts all odp files in a given directory.


User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0
Comment 1 Buovjaga 2018-03-08 10:40:05 UTC

*** This bug has been marked as a duplicate of bug 115808 ***
Comment 2 robert_averbeck 2018-03-08 20:38:00 UTC
Further investigations with png images reveal that the problem is more fundamental. It applies to all images lacking a resolution value in the metadata. For these images Impress defaults to the dpi setting of the monitor, thus making odp documents machine dependent. For an uncropped image this error simply does not show because the aspect ratio stays constant (no distortion) when zooming the image to its bounding box.
Comment 3 Aron Budea 2018-03-09 01:56:39 UTC
Yes, there are a couple of similar bug reports:
https://bugs.documentfoundation.org/showdependencytree.cgi?id=116082&hide_resolved=1