In the draw app, Select File -> export select jpeg file type when the options window open, the default resolution is 96dpi, but the user can change that setting. Change the resolution to 300 or 600 and export. The exported file always has 96dpi regardless of the user setting in the options window.
*** This bug has been marked as a duplicate of bug 37678 ***
It is not duplicate to bug 37678. Bug 37678 is about the behavior of the fields in the dialog. To reproduce this bug do this: Open the attached file. It has 10cm width and 14cm height. File > Export Select file type jpeg. In the export dialog make the following settings in this order: Set Quality to 100 Set Resolution to 300 pixel/inch Set width to 10cm. Save This setting should result (besides rounding errors) in width: (10 / 2.54) * 300 = 1181 Pixel height: (14 / 2.54) * 300 = 1654 Pixel Indeed, the exported image has the size (w x h): 1183 x 1656. But when you look at the stored dpi, as reported by a picture viewer like IrfanView, then you can see the value 96 dpi. The effect is, that other application will calculate a wrong width for this image. You can correct the value to 300 dpi in IrfanView and all is OK. LO 4.2 had not written any dpi into the file, so there it was wrong too. Expected behavior: The resolution, which was used for generating the pixels for export, should be written into the file. Jpeg allows such information. BTW: The export to png does not have this problem, in png-export the dpi value is correctly written.
Created attachment 121172 [details] File to be exported
*** Bug 97481 has been marked as a duplicate of this bug. ***
(In reply to Regina Henschel from comment #2) > But when you look at the stored dpi, as reported by a picture viewer like > IrfanView, then you can see the value 96 dpi. The effect is, that other > application will calculate a wrong width for this image. You can correct the > value to 300 dpi in IrfanView and all is OK. > Well, that might seems to be a result of the patch from bug 65695. Instead of taking the dpi from the resolution setting (which is 96 by default anyway [correct my if i'm wrong]), it seems hardcoded to 96. --> tdf#65695 write density 96 DPI to JPEG files at compression https://cgit.freedesktop.org/libreoffice/core/commit/?id=d0d8e0a2a7244814f783f16c6c8b342fe6d16e79
Unless I'm much mistaken, the Graphics class has no way of getting either the physical size of the graphics image in mm/inches, or alternatively has no way of returning the pixels per inch from which you could extrapolate the physical size... http://opengrok.libreoffice.org/xref/core/include/vcl/graph.hxx#109 This seems like a bit of a shortcoming in this class? Is that something we should consider adding?
OK, about to submit a proposed patch to gerrit.
Asking for a review on Gerrit: https://gerrit.libreoffice.org/22339
So it appears in comment 6 I was mistaken. To get the PPI of an instance of Graphics, you need to get the actual physical size of the image via GetPrefSize, then you need to work out what the logical units are, and from here you can divide the pixel size by the logical size, once that logical size is converted to inches.
Chris Sherlock committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=f8355221ae62b89a706f2d04b63eda658f3ccfa5 tdf#85761 vcl: JPEG export does not save PPI values correctly It will be available in 5.2.0. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
What about 5.1.1 and 5.0.6?
I've got a 5-1 fix loaded up waiting to be reviewed here: https://gerrit.libreoffice.org/#/c/22380/ Bare with me, I've never done a back ported fix before :-) I'm pretty sure it wouldn't be too hard to get a fix into 5.0.6, I guess I need guidance on what the normal course of events is wrt to back porting fixes.
Chris Sherlock committed a patch related to this issue. It has been pushed to "libreoffice-5-1": http://cgit.freedesktop.org/libreoffice/core/commit/?id=a93f7792af5a8ce53ef1dc57380624476e14f933&h=libreoffice-5-1 tdf#85761 vcl: JPEG export does not save PPI values correctly It will be available in 5.1.2. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
I've submitted a gerrit patch for 5.0: https://gerrit.libreoffice.org/c/#/22454/
I've submitted a gerrit patch for 5.0: https://gerrit.libreoffice.org/#/c/22454/
Chris Sherlock committed a patch related to this issue. It has been pushed to "libreoffice-5-0": http://cgit.freedesktop.org/libreoffice/core/commit/?id=a8c2e437a38fcb0cda9f3e8569f32185597f893f&h=libreoffice-5-0 tdf#85761 vcl: JPEG export does not save PPI values correctly It will be available in 5.0.6. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
So two versions 5.1.1 and 5.0.6? https://flappy-bird.co