Bug 136707 - Draw export to png: incorrect density and size for big pictures
Summary: Draw export to png: incorrect density and size for big pictures
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
7.0.0.3 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Graphics-Export
  Show dependency treegraph
 
Reported: 2020-09-13 07:55 UTC by Patrik Eschle
Modified: 2022-12-12 06:22 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Square 100 cm x 100 cm on page 100 cm x 100 cm. Exporting to jpeg works correctly, exporting to png results in wrong density and size (51.78 KB, application/vnd.oasis.opendocument.graphics)
2020-09-13 07:55 UTC, Patrik Eschle
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Patrik Eschle 2020-09-13 07:55:49 UTC
Created attachment 165442 [details]
Square 100 cm x 100 cm on page 100 cm x 100 cm. Exporting to jpeg works correctly, exporting to png results in wrong density and size

A square of size 100 cm x 100 cm is exported from LO-Draw to png. The density is set to 150 dpi and the size to 100 cm x 100 cm. The exported file has an incorrect density of 72 dpi (ImageMagick identify) and an incorrect size of 4096 x 4096 pixels. The size of the exported file corresponds to a density of 4096/(100/2.54) = 104 dpi.

Exporting to jpeg works correctly. With the same settings in the export dialogue the exported file has a density of 150 dpi and a (slightly rounded) size of 5925 x 5925 pixels (100/2.54*150 = 5906). 

To reproduce:
- Open LO-Draw
- Set the page size (Page / Properties) to 100 cm x 100 cm
- Set the margins to 0
- Draw a rectangle
- Set the size of the rectangle to 100 cm x 100 cm and the position to 0,0 (right click / Position and Size / Position and Size)
- Select the rectangle
- File / Export
- In the file dialogue, check "Selection" and select "PNG - .." from the menu
- In the PNG Options dialogue set the resolution to 150 pixels/inch (the size in cm will change)
- Set Width to 100 cm. Pressing TAB will set Height to 100 cm.
- Leave Interlaced and Save transparency checked
- Click "OK"
- Check the result with identify from ImageMagick (or GIMP etc.)
identify -format "%f: size %wx%h, resolution %xx%y dpi, depth %z\n" Test_Resolution_150dpi.png
Test_Resolution_150dpi.png: size 4096x4096, resolution 72x72 dpi, depth 8

Repeat the procedure and export to jpeg with same setting. All figures are as expected.
identify -format "%f: size %wx%h, resolution %xx%y dpi, depth %z\n" Test_Resolution_150dpi.jpg
Test_Resolution_150dpi.jpg: size 5925x5925, resolution 150x150 dpi, depth 8
Comment 1 Robert Großkopf 2020-12-10 18:37:26 UTC
Could confirm the behavior for the testfile. Gives the same result here: 
size 4096x4096
which is about 104dpi. 

But this seems to be a problem of maximum size.
If I set the picture to 20cm x 20cm it will give 2366x2366 when choosing 300dpi. And this is the right value for the resolution.

Test made with different versions of LO, starting with LO 6.1.5.2 and ending with LO 7.0.4.1 on OpenSUSE 15.1 64bit rpm Linux.
Comment 2 QA Administrators 2022-12-12 03:18:17 UTC Comment hidden (obsolete)
Comment 3 Patrik Eschle 2022-12-12 06:22:04 UTC
Result of identify command for png and jpg:

 Untitled 1.png: size 5925x5925, resolution 72x72 dpi, depth 8

 Untitled 1.jpg: size 5925x5925, resolution 150x150 dpi, depth 8

The size in pixels is now correct, the resolution is not.

Also while exporting the width (100 cm) has to be entered twice for the png, but only one (as expected) for the jpg.

Since the number of pixels is now correct, I close this issue.