Bug 107986 - EDITING: The original size will decrease after using compression
Summary: EDITING: The original size will decrease after using compression
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Impress (show other bugs)
(earliest affected) release
Hardware: All All
: medium normal
Assignee: Not Assigned
Depends on:
Blocks: Image-Compression Image-DPI
  Show dependency treegraph
Reported: 2017-05-21 10:00 UTC by Telesto
Modified: 2020-05-01 18:28 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:

Example file (409.68 KB, application/vnd.oasis.opendocument.presentation)
2017-05-21 10:02 UTC, Telesto
Example2 (465.04 KB, application/vnd.oasis.opendocument.text)
2020-05-01 18:28 UTC, Telesto

Note You need to log in before you can comment on or make changes to this bug.
Description Telesto 2017-05-21 10:00:58 UTC
The image size will decrease after using the compression feature

Steps to Reproduce:
1. Open the attached file
2. Right click the image and select Original size (image increases in size)
3. Right click the image and select compress
4. Press OK
5. Right click the image and select Original size -> quite a small image

Actual Results:  
Image shrinks

Expected Results:
Image should keep the original dimensions

Reproducible: Always

User Profile Reset: No

Additional Info:
Found in
Build ID: 8672113ead4e403c55e31b1d9a3d1e0f3b299577
CPU-threads: 4; Besturingssysteem:Windows 6.2; UI-render: standaard; 
Locale: nl-NL (nl_NL); Calc: CL

but not in
Build ID: e8938fd3328e95dcf59dd64e7facd2c7d67c704d
Locale: nl_NL

User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0
Comment 1 Telesto 2017-05-21 10:02:07 UTC
Created attachment 133430 [details]
Example file
Comment 2 Regina Henschel 2017-05-21 15:35:29 UTC
Telesto: What kind of compression do you use? Which settings do you have made in the dialog?
The embedded image has no dpi information, therefore there exist no "original size" because the size of the pixels is unknown. If you click on "Original size" in step 2, LibreOffice uses an ersatz, likely your screen resolution. Calculate the dpi and use the same dpi in the compression dialog.
Comment 3 Telesto 2017-05-21 15:51:31 UTC
I have used:
1. JPG Quality 90:  Reduced image resolution checked set to width  400px, height 529 px and resolution 96 PPI (screen dimensions 10,58x14.00 cm)
2. JPG Quality 90 without reduced image resolution checked
both with same result; a very small image with an apparent dimensions of 0,40 cm x 0,53 cm at 2500 PPI

No issues with the png compression
Comment 4 Regina Henschel 2017-05-21 16:45:19 UTC
Apparently LO sets 1px = 1/100 mm. For me LO chooses for the original png-image a size of 8,47cm × 11,22 cm at 120ppi for its 400 pixel × 530 pixel size.

Expected behavior for the jpg image:
    the same same ersatz value is used for the jpg image and dialog fields are disabled
    the dpi value or width or height respectively, which the user sets in the dialog, is used.

I see this error already in Version:
Build ID: f3e25ec0581f5012f54d8810dcddd5824f4ee374
CPU Threads: 4; OS Version: Windows 6.1; UI Render: default; 
Locale: de-DE (de_DE); Calc: group

The image has no dpi set, and uses the same default as the ersatz as the png image and so shows the same size in Version:
Build ID: 40b1e8266e47792d354cd457c652bfb0f0a21e69
TinderBox: Win-x86@62-TDF, Branch:MASTER, Time: 2015-02-11_00:13:43
Locale: de_DE

Build ID: e9fbe1f7cd28de2a9da8089d89e903406165eb56
TinderBox: Win-x86@62-merge-TDF, Branch:MASTER, Time: 2015-04-25_00:22:55
Locale: de_DE
sets 96dpi although it is 120dpi for me and I set that is the dialog too.
Comment 5 Regina Henschel 2017-05-21 16:50:56 UTC
The fixed for bug 65695 and bug 85761 are likely related.
Comment 6 Telesto 2017-05-21 17:48:33 UTC
Would a bibisect be helpful?
Comment 7 QA Administrators 2019-03-01 03:49:42 UTC Comment hidden (obsolete, spam)
Comment 8 Justin L 2020-03-04 07:30:40 UTC
(The following is my very naive understanding after 3 days of playing with graphics - but seems to me like NOTABUG.)

I don't expect original size would be from "before a compression". It would be a comparison of the compressed "filesize" with the "display size", wouldn't it? Since the display size can stretch or shrink the actual view size, it is good to know the actual dimensions - particularly for cropping values which are calculations from the original size (if I understand correctly).
Comment 9 Telesto 2020-05-01 18:28:25 UTC
Created attachment 160192 [details]

1. Open the attached file
2. Open the compress Image dialog 
- Actual dimensions 16,93 x 12,70 cm (nothing 'actual'. It's based on my screen)
- The apparent dimensions: 16,93 cm c 12,70 ad 95 DPI (dimension suggest 96 dpi)
3. Reduce image resolution: default settings 2001 width x 1500 Height 300 dpi Lanczos. Jpg compression
4. Press Ok
5. Open the compress dialog again
- Actual dimensions 52,94 cm x 39,69 cm (2001 x 1500px)
- Apparent dimensions: 16,93 x 12,70 cm at 300 dpi
8. Format -> Image -> Properties -> Type Tab
9. Press Original size button (21,00 cm Height x 29,70) -> so limited page size, A4

So lacking DPI setting in file, it's based on screen DPI. However different monitors different DPI settings/image sizes. Corel Paint Shop Pro uses a 'default' settings at 200 DPI for images lacking a resolution. Instead of using the screen resolution as reference.

The different between actual dimensions (suggesting 'real measure') and apparent dimensions quite confusing at minimum. Also what's meant with "apparent" dimensions open for debate, IMHO. Increase the size of the image and the apparent dimensions change (of course) + DPI will be lower. Recompress the image with "Reduce image resolution" at default settings and you have an image of 300 DPI with the same dimensions. 

Always using the apparent resolution would solve a part of the problem. Except I'm not sure what happens on a high DPI screen.. Is there a difference on screen (Writer/Calc/Draw) between the size of the image on 96 dpi and 120 dpi screen?

Another solution would be some random - not screen based setting - at say 200dpi (and an option to change it in Expert configuration), if no resolution is set.

The "actual dimensions" are used the Image Properties Type tab (original size button) as the "original size' which is misleading at minimum.