Bug 150310 - Changing the DPI during Export of PNG and JPEG does not change the resulting file
Summary: Changing the DPI during Export of PNG and JPEG does not change the resulting ...
Status: RESOLVED DUPLICATE of bug 144195
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
6.4.7.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-08-09 13:24 UTC by Rafael Lima
Modified: 2023-06-19 10:10 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
test results on LO 7.2 and 7.3 (26.54 KB, application/vnd.oasis.opendocument.spreadsheet)
2022-08-18 19:21 UTC, Stéphane Guillou (stragu)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rafael Lima 2022-08-09 13:24:52 UTC
By default the PNG export filter uses 96 dpi. However, changing it in the "PNG Options" dialog does not change the resulting exported PNG file.

Steps to reproduce:

PART A: Create a default PNG export
1) Create a new Drawing and insert a single shape into it
2) Select the shape and go to File - Export
3) Check "Selection" and give a name to the file
4) Select the PNG filter and click Save
5) In the "PNG Options" dialog, do not change anything (here we want the default export)
6) Click OK
7) Now check the file size and open it

PART B: Create a PNG with higher DPI (f.i. 300 dpi)
1) Select the same shape from Part A
2) Do the same steps, but now in the "PNG Options" click "Modify Resolution" and enter 300 in the resolution field (make sure the "pixels/inch" measure is selected)
3) Click OK
4) Now go check the file. It is identical to the file from Part A (they even have the same MD5 checksums)

Both files should be different. File from Part B should have higher resolution, but instead both files are identical.

System info

Version: 7.3.5.2 / LibreOffice Community
Build ID: 30(Build:2)
CPU threads: 16; OS: Linux 5.15; UI render: default; VCL: kf5 (cairo+xcb)
Locale: pt-BR (pt_BR.UTF-8); UI: en-US
Ubuntu package version: 1:7.3.5-0ubuntu0.22.04.1
Calc: threaded

Also repro in

Version: 7.5.0.0.alpha0+ / LibreOffice Community
Build ID: c2e86396b741b956efc05e9dfea1e1c3286dfb9d
CPU threads: 16; OS: Linux 5.15; UI render: default; VCL: kf5 (cairo+xcb)
Locale: pt-BR (pt_BR.UTF-8); UI: en-US
Calc: threaded
Comment 1 Rafael Lima 2022-08-09 15:34:42 UTC
The export images are identical when the "Modify Resolution" is selected. However, the "Modify Dimensions" option works as expected, resulting in different files with the specified dimensions.
Comment 2 Stéphane Guillou (stragu) 2022-08-11 20:43:44 UTC
Also reproduced in:

Version: 7.4.0.2 / LibreOffice Community
Build ID: 1512ce97d7ed39dce3121f7e15651fd8895f950e
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded
Comment 3 Rafael Lima 2022-08-17 12:37:09 UTC
I also tested with the JPEG format to export a shape as image and the results were the same. Changing the DPI does not change the resulting image.

It seems like the "Modify resolution" part of the dialog is simply being ignored. "Modify dimension" works fine.

I found another weird inconsistency in the dialog. Try the following steps:

STEPS TO REPRODUCE
PART A (Create a default image)
1) Follow the same steps as in Part A from comment #0 using the PNG filter (the exact same thing will happen with JPEG).

PART B
1) Follow the same steps from Part A, but now change the export settings
2) In "Modify Dimension" change the Height to a value that is larger than the current value. The width will automatically adjust to keep the aspect ratio.
3) Export the file; notice that now the file is indeed larger (as expected)

Part C (Here's the weird bit)
1) Follow the same steps from Part A, but now change the export settings
2) First click "Modify Resolution" and change the DPI to 200; after that click "Modify Dimension" and change the height to the same value used in Part B.
3) Export the image; Now a third different file was created, which is twice the size of the image in Part B. This is not expected because now the DPI information in the dialog affected the resulting image.

However, the resulting image does not have 200 DPI. Instead, the higher DPI increased the image size, but the pixel density remained the same.

Based on these experiments, I'm start to think there might be something wrong with the dialog itself, with how it processes the user inputs.
Comment 4 Stéphane Guillou (stragu) 2022-08-18 19:21:38 UTC
Created attachment 181869 [details]
test results on LO 7.2 and 7.3

Could also confirm for PNG with:

Version: 7.2.7.2 / LibreOffice Community
Build ID: 8d71d29d553c0f7dcbfa38fbfda25ee34cce99a2
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

But also for:

Version: 6.4.7.2
Build ID: 1:6.4.7-0ubuntu0.20.04.4
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3; 
Locale: en-AU (en_AU.UTF-8); UI-Language: en-US
Calc: threaded

However, I could not confirm with JPG, unfortunately. The JPG exports' shasums are different, and the DPIs are correct in the image properties.
See the attached table of results for my tests for 7.2 and 7.3.
Wondering if the JPG issue should be reported seperately?

About the PNG export, notice that even with the default settings, the DPI chosen is not respected: for both 96 and 300 DPI, you end up with a 72 DPI file.

Tips for testing:
- GIMP is useful to check resolution and size (with Image > Image Properties).
- The bash command shasum can be used to check if the files are the same (shasum filename.png)
Comment 5 Stéphane Guillou (stragu) 2023-06-19 10:10:54 UTC
The source cause is bug 144195, so marking as duplicate.

*** This bug has been marked as a duplicate of bug 144195 ***