Bug 105954 - When exporting to pdf and choosing "JPEG compression", "reduce image resolution" isn't taken into account.
Summary: When exporting to pdf and choosing "JPEG compression", "reduce image resoluti...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Printing and PDF export (show other bugs)
Version:
(earliest affected)
5.2.0.4 release
Hardware: All All
: medium minor
Assignee: Miklos Vajna
URL:
Whiteboard: target:6.1.0 target:6.0.5
Keywords: bibisected, bisected, regression
: 116904 (view as bug list)
Depends on:
Blocks: PDF-Export JPEG-compression-regressions
  Show dependency treegraph
 
Reported: 2017-02-12 13:42 UTC by info
Modified: 2018-06-06 17:48 UTC (History)
8 users (show)

See Also:
Crash report or crash signature:


Attachments
Jpg for testing pdf export (63.75 KB, image/jpeg)
2017-02-12 17:05 UTC, info
Details

Note You need to log in before you can comment on or make changes to this bug.
Description info 2017-02-12 13:42:50 UTC
Hi,

Bug discovered under windows 10 pro and LibreOffice 5.2.4.2 (French version).
Still there on 5.2.5.1 (XP pro).
On 5.1.4 (Ubuntu 16.04) everything is OK.

Under Writer, Draw or Calc, when I export to pdf and chose "JPEG Compression", the other parameter "Reduce image resolution" doesn't work. 

I.e if there are "big" images in the document, the generated pdf has big images in it and is sometime hard to read with several pdf reader (no image or artefacts or ...).

When I chose "Lossless compression" everything works as expected. 

Strangely, Impress seems not to be affected by this bug : "Jpeg" or "Lossless" equally works.

Sincerly,

Sylvain.
Comment 1 Jean-Baptiste Faure 2017-02-12 16:08:56 UTC
Not sure to understand correctly what you mean. There is several bug report about image compression in pdf export. For example bug 99723 and bug 100890.

Please could you describe more precisely your finding with numbers and a clear step by step procedure to reproduce the problem.

Please attach a sample document with which you see the problem, as this makes it easier for us to verify the bug. 

I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' once the requested document is provided.
(Please note that the attachment will be public, remove any sensitive information before attaching it. See https://wiki.documentfoundation.org/QA/FAQ#How_can_I_eliminate_confidential_data_from_a_sample_document.3F for help on how to do so.)

Best regards. JBF
Comment 2 info 2017-02-12 17:05:55 UTC
Created attachment 131148 [details]
Jpg for testing pdf export
Comment 3 info 2017-02-12 17:29:28 UTC
Sorry, I now realise that the bug is not as easy as I thought to reproduce.

So :

1/ Take a jpg image (for example the one I attached, 4000 x 439 px ~ 64ko).
2/ Open a new odt document (A4 vertical for example).
3/ Insert this image in your odt and then resize it "a lot", for example to 2cm in width.
4/ **SAVE** the odt (otherwise it won't bug.)
5/ Now you should have a ~73 ko .odt 
6/ Export as pdf and chose "Lossless compression" and "reduce image resolution 300dpi" you should obtain a ~9ko pdf (which seems normal).
7/ Do the same but with "JPEG Compression 90%" and still "reduce image resolution 300dpi" you should now obtain a 66 Ko pdf (which isn't normal ...)

If you open the 66Ko pdf and copy the included image to GIMP you will see that it is still the "full" 4000x439px image so it hasn't been reduce in size.

It seems that in certain cases the "reduce image resolution 300dpi" option isn't taken into account.

Sincerely,

Sylvain.
Comment 4 Buovjaga 2017-02-13 12:45:49 UTC
Repro.

The file size with version 3.5 is 7k with JPEG + reduce.

Is the problem on Ubuntu 5.2 as well? Then we could change OS to All.

Win 7 Pro 64-bit Version: 5.4.0.0.alpha0+
Build ID: 1d810b69a584fc33f4178c7012f68f551ba2e03b
CPU Threads: 4; OS Version: Windows 6.1; UI Render: default; 
TinderBox: Win-x86@42, Branch:master, Time: 2017-02-12_23:34:02
Locale: fi-FI (fi_FI); Calc: CL

LibreOffice 3.5.0rc3 
Build ID: 7e68ba2-a744ebf-1f241b7-c506db1-7d53735
Comment 5 Aron Budea 2017-02-17 03:49:37 UTC
The winner is the same commit as in bug 99723. Adding Cc: to Michael Meeks.

https://cgit.freedesktop.org/libreoffice/core/commit/?id=76ec54e8c9f3580450bca85236a4f5af0c328588
author		Michael Meeks <michael.meeks@collabora.com>	2016-02-08 14:24:15 (GMT)
committer	Michael Meeks <michael.meeks@collabora.com>	2016-02-09 00:09:08 (GMT)

"tdf#97662 - Try to preserve original compressed JPEGs harder."
Comment 6 Julien Nabet 2017-09-30 11:54:05 UTC
On pc Debian x86-64 with master sources updated yesterday, I could reproduce this.
I added some traces in HasAdequateCompression method (see https://opengrok.libreoffice.org/xref/core/vcl/source/gdi/pdfextoutdevdata.cxx#800)
Whatever we resize the logo or not in LO, I always see the same values:
aSize.Width()=2000 aSize.Height()=439 rGraphic.GetLink().GetDataSize()=65280

I think we should test if there's been some resizing or not.
The pb is I don't know how to retrieve the resized values.
Comment 7 Commit Notification 2018-05-17 06:46:37 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=9fd6b6b1f5b83d923a47252b744358721761d9cf

tdf#105954 PDF export, ReduceImageResolution: fix re-compressing large images

It will be available in 6.1.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 8 Commit Notification 2018-05-18 07:55:34 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "libreoffice-6-0":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=efd59fd1d7fc9d955a2b924f247709201f2281c5&h=libreoffice-6-0

tdf#105954 PDF export, ReduceImageResolution: fix re-compressing large images

It will be available in 6.0.5.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 9 Jean-Baptiste Faure 2018-05-20 17:29:38 UTC
Verified fixed in master:
Version: 6.1.0.0.alpha1+
Build ID: 99343e6305eeeceb40a8e7ff551cb6cb1d2901af
Threads CPU : 4; OS : Linux 4.4; UI Render : par défaut; VCL: gtk3; 
Ubuntu_16.04_x86-64
Locale : fr-FR (fr_FR.UTF-8); Calc: threaded

Thank you very much.
Best regards. JBF
Comment 10 Timur 2018-05-21 16:27:07 UTC
*** Bug 104479 has been marked as a duplicate of this bug. ***
Comment 11 Buovjaga 2018-06-06 17:48:07 UTC
*** Bug 116904 has been marked as a duplicate of this bug. ***