Bug 134497 - PNG not exported with the same dimensions
Summary: PNG not exported with the same dimensions
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
3.4.0 release
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Graphics-Export
  Show dependency treegraph
 
Reported: 2020-07-04 12:48 UTC by taro
Modified: 2023-09-06 22:36 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Position and size dialog, Export dialog (125.79 KB, application/pdf)
2020-10-23 06:47 UTC, Robo Pluhar
Details
PNG Options dialogue - export size in px vs original pixture size in px (111.13 KB, image/png)
2020-10-23 10:50 UTC, Robo Pluhar
Details
PNG image for testing, 742x300px (7.62 KB, image/png)
2021-07-28 14:45 UTC, Robo Pluhar
Details
Inage properties (PhotoFiltre, IrfanView) (171.25 KB, image/png)
2021-07-28 18:21 UTC, Robo Pluhar
Details

Note You need to log in before you can comment on or make changes to this bug.
Description taro 2020-07-04 12:48:52 UTC
Description:
draw で PNG 画像を挿入した図形をPNG形式でエクスポートすると、挿入した画像が乱れて正常に表示されないことがある。

Actual Results:
画像が壊れてエクスポートされる。

Expected Results:
画像が壊れずにエクスポートされる。


Reproducible: Sometimes


User Profile Reset: No


OpenGL enabled: Yes

Additional Info:
[Information automatically included from LibreOffice]
Locale: ja
Module: TextDocument
[Information guessed from browser]
OS: Windows (All)
OS is 64bit: yes
Comment 1 Julien Nabet 2020-07-05 09:01:15 UTC
Could you give a try to last stable LO version 6.4.5?

Also, do you have this behaviour for any image or just specific images?
Comment 2 V Stuart Foote 2020-07-05 14:36:47 UTC
from Google translate gloss...
<clip>
Description:
When you export a PNG image with a PNG image inserted in draw in PNG format, the inserted image may be distorted and may not be displayed normally.

Actual Results:
The image is corrupted and exported.

Expected Results:
The image is exported without corruption.
</clip>
Comment 3 Robo Pluhar 2020-10-23 06:47:14 UTC
Created attachment 166653 [details]
Position and size dialog, Export dialog

I have probably the same experience. My LO is:
Version: 6.4.6.2
Build ID: 1:6.4.6-0ubuntu0.20.04.1
CPU threads: 8; OS: Linux 5.4; UI render: default; VCL: gtk3; 
Locale: cs-CZ (en_DK.UTF-8); UI-Language: en-US
Calc: threaded

Example: 
1) A source PNG image has resolution 742x300px.
2) PNG is inserted into Draw by drag-and-drop.
3) Right click to PNG image > original size.
4) In the Position and Size dialog I can see size 742.1 pt x 300.0 pt.
5) CTRL-A (select all). Selected area is the same as the picture (there is nothig outside the original picture).
6) File > Export... 
7) In the Export dialog check Selection, output format: PNG.
8) PNG Options dialog appears - strangely enough the size is: 742.41 x 299.96 points, resolution 37 pixels/cm. Click OK.
9) Exported image has resolution 990x400px (what can I see is the same what was previously selected - different resolution is not caused by exporting more than it is supposed). And the picture is blurred of course.

BTW: When I am in the step 8) and change the width of the picture to 742 points (instead of 742.41), and click to the height field, LO Draw crashes immediately.

So I can see only one way how to export PNG image without any distortion:
1) Zoom the picture to 100% size.
2) Make a screenshot.
And for small pictures it is actually simpler way than use export dialog (as export dialog does not remember my settings so I have to check "Selection" and change export format from JPG to PNG during every export).
Comment 4 Robo Pluhar 2020-10-23 10:50:24 UTC
Created attachment 166659 [details]
PNG Options dialogue - export size in px vs original pixture size in px

Additional info:
I realized that I can set units to pixels in the PNG Options dialogue:
1) Before I set size to pixels, there is default size 990 x 400 pixels.
2) When I change Width to 724 pixels, LO changes Height to 293 pixels (instead of 724x300 px, which is original picture resolution, see attachment).
3) Exported picture has size 724x293px. 

Expected results:
* when exported picture is in its original size (in the drawing), the PNG Options dialogue should use the same size in pixels by default,
* aspect ratio should be preserved.

Tested on Xubuntu 20.04, LO Version: 7.0.2.2
Build ID: 0b4360524e0359c479b908cb9f8f3765ab0cc7ad
CPU threads: 2; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 5 Buovjaga 2021-07-27 10:47:55 UTC
We need an example png to test
Comment 6 Robo Pluhar 2021-07-28 14:45:07 UTC
Created attachment 173920 [details]
PNG image for testing, 742x300px

There is a picture 742x300 px in the attachment. In my previous comment (nr. 4) I made a mistake and used 724px instead of 742. I am sorry for that.
Now, when I use correct width 742px in the "PNG Options" dialogue LO calculates 300px height (which is correct and aspect ratio is preserved).

So expected result is just one:
* when exported picture is in its original size (in the drawing), the PNG Options dialogue should use the same size in pixels by default.
Comment 7 Buovjaga 2021-07-28 16:23:00 UTC
(In reply to Robo Pluhar from comment #6)
> Created attachment 173920 [details]
> PNG image for testing, 742x300px
> 
> There is a picture 742x300 px in the attachment. In my previous comment (nr.
> 4) I made a mistake and used 724px instead of 742. I am sorry for that.
> Now, when I use correct width 742px in the "PNG Options" dialogue LO
> calculates 300px height (which is correct and aspect ratio is preserved).
> 
> So expected result is just one:
> * when exported picture is in its original size (in the drawing), the PNG
> Options dialogue should use the same size in pixels by default.

This image has a weird DPI. If I open it with GIMP and view Image - Properties, it shows DPI as 2,834×2,834 px/mm. GIMP does export it correctly, however, and even preserves the DPI.

With LibreOffice, to export an image in its original size, you need to right-click the image and select Original size first. If we do it in this case, the exported resolution is 990x400 and the DPI will change to 72x72 ppi.

So LibreOffice should learn to behave as smartly as GIMP.

NixOS
Version: 7.3.0.0.alpha0+ / LibreOffice Community
Build ID: 67e47070a7580a17804adce812cc2f98bfe7b51f
CPU threads: 16; OS: Linux 5.13; UI render: default; VCL: x11
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: threaded
Comment 8 Robo Pluhar 2021-07-28 18:21:10 UTC
Created attachment 173933 [details]
Inage properties (PhotoFiltre, IrfanView)

(In reply to Buovjaga from comment #7)
> This image has a weird DPI. If I open it with GIMP and view Image -
> Properties, it shows DPI as 2,834×2,834 px/mm. GIMP does export it
> correctly, however, and even preserves the DPI.
> 
> With LibreOffice, to export an image in its original size, you need to
> right-click the image and select Original size first. If we do it in this
> case, the exported resolution is 990x400 and the DPI will change to 72x72
> ppi.

I opened the image in PhotoFiltre and IrfanView and both of them claim that the DPI is 72x72, and ImageMagick says:

$ identify -verbose -units PixelsPerInch ExStudPr_17_predmet_planu_plain.png
Image: ExStudPr_17_predmet_planu_plain.png
  Format: PNG (Portable Network Graphics)
  Mime type: image/png
  Class: DirectClass
  Geometry: 742x300+0+0
  Resolution: 71.98x71.98
  Print size: 10.3084x4.16782
  Units: PixelsPerInch
....
Version: ImageMagick 6.9.10-23 Q16 x86_64 20190101 https://imagemagick.org
Comment 9 Buovjaga 2021-07-28 18:40:51 UTC
(In reply to Robo Pluhar from comment #8)
> Created attachment 173933 [details]
> Inage properties (PhotoFiltre, IrfanView)
> 
> (In reply to Buovjaga from comment #7)
> > This image has a weird DPI. If I open it with GIMP and view Image -
> > Properties, it shows DPI as 2,834×2,834 px/mm. GIMP does export it
> > correctly, however, and even preserves the DPI.
> > 
> > With LibreOffice, to export an image in its original size, you need to
> > right-click the image and select Original size first. If we do it in this
> > case, the exported resolution is 990x400 and the DPI will change to 72x72
> > ppi.
> 
> I opened the image in PhotoFiltre and IrfanView and both of them claim that
> the DPI is 72x72, and ImageMagick says:
> 
> $ identify -verbose -units PixelsPerInch ExStudPr_17_predmet_planu_plain.png
> Image: ExStudPr_17_predmet_planu_plain.png
>   Format: PNG (Portable Network Graphics)
>   Mime type: image/png
>   Class: DirectClass
>   Geometry: 742x300+0+0
>   Resolution: 71.98x71.98
>   Print size: 10.3084x4.16782
>   Units: PixelsPerInch
> ....
> Version: ImageMagick 6.9.10-23 Q16 x86_64 20190101 https://imagemagick.org

Hmm, you are right. 2,834×2,834 px/mm is the same approximation as 72x72 ppi.
Comment 10 Buovjaga 2021-08-14 14:18:50 UTC
Already behaves like this in oldest of Linux 43all bibisect repo
Comment 11 QA Administrators 2023-08-15 03:15:10 UTC
Dear taro,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
 
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)


If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword


Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team

MassPing-UntouchedBug