Bug 137848 - Inserted image slow (15 seconds, expected 3)
Summary: Inserted image slow (15 seconds, expected 3)
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected) release
Hardware: All All
: medium normal
Assignee: Not Assigned
Keywords: bibisected, bisected, perf
Depends on:
Reported: 2020-10-29 08:58 UTC by Telesto
Modified: 2022-06-06 14:49 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:
Regression By:

Example file (2.36 MB, application/vnd.oasis.opendocument.text)
2021-10-03 08:59 UTC, Telesto

Note You need to log in before you can comment on or make changes to this bug.
Description Telesto 2020-10-29 08:58:17 UTC
Changing inserted image to standard orientation slowish

Steps to Reproduce:
1. Download attachment 166816 [details]
2. Insert -> Image -> 
3. This image is rotated. Would you like to rotate it into standard orientation?
4. Press YES -> wait

Actual Results:
Rotating is slow

Expected Results:

Reproducible: Always

User Profile Reset: No

Additional Info:
Version: (x64)
Build ID: 94e6e140491de31c0788c91af855a75a3bb12709
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win
Locale: nl-NL (nl_NL); UI: en-US
Calc: CL
Comment 1 Telesto 2020-10-29 09:00:02 UTC
Taking 15 seconds or so
Comment 2 Telesto 2020-10-29 09:01:07 UTC
Also in 6.1

Feature for rotation isn't present in 6.0
Comment 3 Xisco Faulí 2021-02-15 18:05:27 UTC
Hi Telesto,
Could you please try to reproduce it with a master build from
http://dev-builds.libreoffice.org/daily/master/ ?
You can install it alongside the standard version.
I have set the bug's status to 'NEEDINFO'. Please change it back to
'UNCONFIRMED' if the bug is still present in the master build
Comment 4 QA Administrators 2021-08-16 03:49:41 UTC Comment hidden (obsolete)
Comment 5 QA Administrators 2021-09-16 03:27:36 UTC Comment hidden (obsolete)
Comment 6 Telesto 2021-09-16 11:14:21 UTC
Found in
Build ID: 05dceb5d363845f2cf968344d7adab8dcfb2ba71

not in
Build ID: 89ea49ddacd9aa532507cbf852f2bb22b1ace28

[if you do rotate or not being irrelevant; at least for 4.1]
Comment 7 QA Administrators 2021-09-17 03:53:20 UTC Comment hidden (obsolete)
Comment 8 raal 2021-10-02 18:49:34 UTC
It takes long time in Version:
Build ID: 6eeac3539ea4cac32d126c5e24141f262eb5a4d9 and Version: / LibreOffice Community Build ID: b63c5ade3554a42def4bce94f9fd67ea66528214

It's fast in Version:
Build ID: a2c9d4f8bbde97f175bae4df771273a61251f40
Comment 9 raal 2021-10-02 19:04:19 UTC
This seems to have begun at the below commit.
Adding Cc: to Tomaž Vajngerl; Could you possibly take a look at this one?
 1df7d956210d4a9111e6a88000c9ab2e955b57b4 is the first bad commit
commit 1df7d956210d4a9111e6a88000c9ab2e955b57b4
Author: Matthew Francis <mjay.francis@gmail.com>
Date:   Sat Sep 5 19:27:56 2015 +0800

    commit 698315531414b223b35d8507fdf2f56dbcf6bc4c
    Author:     Tomaž Vajngerl <quikee@gmail.com>
    AuthorDate: Sun Jul 28 15:52:14 2013 +0200
    Commit:     Tomaž Vajngerl <quikee@gmail.com>
    CommitDate: Sun Jul 28 16:06:44 2013 +0200
        fdo#66006 Convert to PNG for JPEG that can't be losslessly rotated
        If a JPEG image has a width or height which is not a multiple of 16
        (width/heigh % 16 != 0) then it can't be completelly lossleessly
        rotated (the last uncomplete MCUs can't be rotated) and the image
        is cropped on the lower size. To prevent this such JPEG images
        must be rotated to PNG to prevent loss. Afterwards image can still
        be compressed with "Compress Graphic Dialog".

Probably not a bug, but a feature - converting to PNG takes some time.
Comment 10 Telesto 2021-10-03 08:59:38 UTC
Created attachment 175471 [details]
Example file

(In reply to raal from comment #9)
> Probably not a bug, but a feature - converting to PNG takes some time.

Well, the commit might do the proper thing, but still fishy.

1) Attached the same image (unrotated). Compressing the image with 7.3 takes 6-7 seconds (without reducing image resolution). So it's not the compression as such taking 15 seconds. Rotation shouldn't be that expensive. 

Note: compressing in 4.2 was slow in general. So maybe some optimization been done for the regular case, but not this one?

1) 4.2 ask for rotation; 7.3 simply does (no clue why the dialog had to go). Lack of feedback.. Especially if it takes a longer time.
Comment 11 Telesto 2021-10-03 09:03:08 UTC
Quite a corner case, but perf isn't great under specific circumstances.
Comment 12 Tomaz Vajngerl 2021-10-04 17:08:14 UTC
This functionality was added when we didn't have a working image rotation in Writer yet, so all we could do is try to rotate the image itself. 

Now we could just simply apply the rotation property in this case.