Bug 163607 - PDF: slow export with "reduce image resolution" or "JPEG compression"
Summary: PDF: slow export with "reduce image resolution" or "JPEG compression"
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Impress (show other bugs)
Version:
(earliest affected)
24.2.6.2 release
Hardware: All All
: medium minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: haveBacktrace, perf
Depends on:
Blocks: PDF-Export
  Show dependency treegraph
 
Reported: 2024-10-24 16:06 UTC by Antoine Pitrou
Modified: 2025-10-14 19:55 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Test file (503.98 KB, application/vnd.oasis.opendocument.presentation)
2025-10-14 19:22 UTC, Antoine Pitrou
Details
Perf flamegraph of PDF export (1.74 MB, image/svg+xml)
2025-10-14 19:55 UTC, Buovjaga
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Antoine Pitrou 2024-10-24 16:06:42 UTC
I'm currently writing a presentation using Impress and export to PDF is very slow. It takes more than 30 seconds using "Direct export to PDF" even though the presentation is quite simple.

Presentation characteristics:
- 19 slides
- ODP file is ~500 kB
- exported PDF file is ~630 kB

The exported PDF file itself is fine, it loads and renders quickly with a PDF reader.

**Note:** I'm using the snap version of LibreOffice on Ubuntu 22.04, in case that matters.

Version: 24.2.6.2 (X86_64) / LibreOffice Community
Build ID: 8e9a753d9daaea75c34b417ba1bdf556bf2fc5b3
CPU threads: 24; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: fr-FR (fr_FR.UTF-8); UI: fr-FR
Calc: CL threaded
Comment 1 m_a_riosv 2024-10-24 19:41:22 UTC
Direct export uses the last options used in Menu>File>Export as>Export as PDF.
Comment 2 Antoine Pitrou 2024-10-24 19:55:04 UTC
(In reply to m_a_riosv from comment #1)
> Direct export uses the last options used in Menu>File>Export as>Export as
> PDF.

I see. I don't think I have changed any option in the past. Should I try anything specifically?
Comment 3 m_a_riosv 2024-10-24 20:10:39 UTC
If you have marked 'Universal accessibility', test no marking 'Tagged PDF'
Comment 4 Antoine Pitrou 2024-10-24 20:14:20 UTC
Ok, I have disabled both options now, and it's still as slow.
Comment 5 Antoine Pitrou 2024-10-24 20:27:18 UTC
Ok, I have found the two responsible options:

- if I disable "reduce image resolution" and select "JPEG compression", PDF export takes ~8 seconds
- if I disable "reduce image resolution" and select "lossless compression", PDF export takes ~3 seconds

So the main contributor is "reduce image resolution" and a secondary contributor is "JPEG compression".

(I'll note that this all runs on a single CPU core even though I have a 12-core CPU)
Comment 6 Antoine Pitrou 2024-10-25 12:45:39 UTC
One additional finding:
- the 30+ seconds export is with "reduce image resolution" enabled and set to 300 DPI
- if I set it to 75 DPI, the export takes ~15 seconds instead, which is better but still quite slow
Comment 7 m_a_riosv 2024-10-25 15:25:25 UTC
Please attach a sample file(s).
Comment 8 Antoine Pitrou 2024-10-25 15:26:50 UTC
Is it ok if I send it privately for now? The file is meant to be later published, but it's not the final version yet.
Comment 9 m_a_riosv 2024-10-25 15:37:24 UTC
Ok
Comment 10 Antoine Pitrou 2024-10-25 15:50:45 UTC
Ok, I've e-mailed it to you @m_a_riosv
Comment 11 m_a_riosv 2024-10-26 22:32:25 UTC
For me only about 15 seconds with
Version: 24.8.2.1 (X86_64) / LibreOffice Community
Build ID: 0f794b6e29741098670a3b95d60478a65d05ef13
CPU threads: 16; OS: Windows 11 X86_64 (10.0 build 26100); UI render: Skia/Raster; VCL: win
Locale: es-ES (es_ES); UI: en-US
Calc: CL threaded

But disabling 
General - Archival (PDF/A ISO 19005)
makes it to export much quicker.

I think the slowness is with images with transparency, which can be located through the side browser. Especially the ones that are one on top of the other.
Comment 12 Buovjaga 2025-10-14 18:40:56 UTC
We still need examples that you can share in public. Also, transparency handling has received numerous changes under the hood, please test with the latest version or preferably the unreleased 26.2.
Comment 13 Antoine Pitrou 2025-10-14 18:46:15 UTC
(In reply to Buovjaga from comment #12)
> We still need examples that you can share in public. Also, transparency
> handling has received numerous changes under the hood, please test with the
> latest version or preferably the unreleased 26.2.

Would version 25.2.6.2 work or is it too old already?
Comment 14 Buovjaga 2025-10-14 19:00:16 UTC
(In reply to Antoine Pitrou from comment #13)
> (In reply to Buovjaga from comment #12)
> > We still need examples that you can share in public. Also, transparency
> > handling has received numerous changes under the hood, please test with the
> > latest version or preferably the unreleased 26.2.
> 
> Would version 25.2.6.2 work or is it too old already?

26.2 would be best: https://wiki.documentfoundation.org/Installing_in_parallel/Linux#Automated_installation
Comment 15 Antoine Pitrou 2025-10-14 19:21:44 UTC
Ok, I've tried with this version:

"""
Version: 26.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 3b0ea28e061f9335b907ae8febfadf8fc04c599b
CPU threads: 24; OS: Linux 6.14; UI render: default; VCL: gtk3
Locale: fr-FR (fr_FR.UTF-8); UI: en-US
Calc: CL threaded
"""

The outcome:

- PDF export with "JPEG compression" (90%) and "Reduce image resolution" (300 DPI): 6 seconds
- PDF export with either "lossless compression" or without "Reduce image resolution": 2 seconds

Clearly this is much faster, though it strikes me that adding JPEG compression consumes a lot of time while the document really has very few images.

I'll also attach the file I'm testing with.
Comment 16 Antoine Pitrou 2025-10-14 19:22:14 UTC
Created attachment 203331 [details]
Test file
Comment 17 Buovjaga 2025-10-14 19:55:02 UTC
Created attachment 203334 [details]
Perf flamegraph of PDF export

Flamegraph from KDAB Hotspot.

Looks like an ImplScaleConvolution function is slow at least.

Arch Linux 64-bit
Version: 26.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: d0e936765b1b68d614271642629df6c615c7e9ae
CPU threads: 8; OS: Linux 6.17; UI render: default; VCL: gtk3
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: CL threaded
Built on 8 October 2025