Bug 33656 - Cropped Picture in PDF export extremely distorted with option "lossless compression" of images
Summary: Cropped Picture in PDF export extremely distorted with option "lossless compr...
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
3.3.2 release
Hardware: x86 (IA32) All
: medium major
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 47692 47713 64719 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-01-28 07:50 UTC by gleppert
Modified: 2014-07-20 09:24 UTC (History)
13 users (show)

See Also:
Crash report or crash signature:


Attachments
Distorted-PDF-Test.odp (346.22 KB, application/vnd.oasis.opendocument.presentation)
2011-01-28 07:50 UTC, gleppert
Details
Distorted-PDF-Test.pdf (366.78 KB, application/pdf)
2011-01-28 07:53 UTC, gleppert
Details
See Comment 5 (51.61 KB, application/x-zip-compressed)
2011-02-10 22:39 UTC, Rainer Bielefeld Retired
Details
pdf ok with 3.5 branch (377.38 KB, application/pdf)
2012-09-22 23:12 UTC, Julien Nabet
Details
Distorted-PDF-Test-tested-with-LO-3.5.4 (366.50 KB, application/pdf)
2012-09-23 07:28 UTC, gleppert
Details
Test case -- export as PDF. (295.83 KB, application/vnd.oasis.opendocument.graphics)
2014-05-18 05:26 UTC, dE
Details
PDF export result. (326.21 KB, application/pdf)
2014-05-18 05:27 UTC, dE
Details

Note You need to log in before you can comment on or make changes to this bug.
Description gleppert 2011-01-28 07:50:14 UTC
The PDF export of attached presentation is extremely distorted & unusable.

Please have a look at the attached files. The layout of the two slides in the ODP-file is perfect. Both slides include one image each. I have written and drawn something on these images in order to highlight some information for students.

If you export these two slides to PDF, you get a completely different result. The image of slide 2 appears on slide 1 and vice versa. 

The drawings and writings don't appear there where they are supposed to appear, but somewhere else. 

Please compare attached PDF with the ODP.

The result in the PDF is absolutely not usable.
Comment 1 gleppert 2011-01-28 07:50:56 UTC
Created attachment 42655 [details]
Distorted-PDF-Test.odp
Comment 2 gleppert 2011-01-28 07:53:14 UTC
Created attachment 42656 [details]
Distorted-PDF-Test.pdf
Comment 3 gleppert 2011-01-29 00:53:00 UTC
[Remark: It seems that the freedesktop bugs-tool does not send out emails to bug reporter and other persons any more. Is sending emails broken in freedesktop bugzilla?]
Comment 4 Jean-Baptiste Faure 2011-01-30 00:04:31 UTC
Hi,

I do reproduce the problem only if I choose the "lossless compression" option for PDF export. With JPEG compression, even with quality set to 100%, there is no distortion.

I do not know if that is a bug because your pictures are resized in your slides.

Ubuntu 10.04, tested with vanilla LibO 3.3 final and PPA version.

Kind regards. JBF
Comment 5 Rainer Bielefeld Retired 2011-02-10 22:16:06 UTC
[Reproducible] with "LibreOffice 3.3.0 RC4 - WIN7  Home Premium (64bit) English UI [OOO330m19 (build 6 / tag 3.3.0.4)]" and lossless export 8others not tested)..

The main problem is that the cropped embedded picture "100000000000067500000922436660D5.jpg" (showing the main text on both pages) will be distorted in the PDF export.
My verty vague suspect (I did not test) is the reason might be that the source .jpg exceeds the page borders?

Print on a OKI laser printer did not show that distortion.

This is not a special Presentation problem, I also see it with DRAW, but not in WRITER.

I created a more simple test kit to reproduce the problem. You see "source.odg", from what I exported "complete.jpg" with all drawing contents and "part.jpg".

1. Into a new landscape DRAW document "test.odg" I inserted "part.jpg" on page 1
2. Resized it (keeping ration) so that it fills full document width
3. inserted 4 additional small rectangles to mark the corners of the .jpg
5. I inserted "complete.jpg" on page 2
6. increased size as much as possible
7. cropped (using crop control points so that only the inner
   rectangles are visible
9. increased size of visible  "complete.jpg" so that it filled complete document
   width
10. inserted 4 additional small rectangles to mark the corners of the .jpg
11. exported to "test.pdf"
12. You see the same distortions on page 2 as shown in sample of original
    report.

Modified Component because only DRAW and Presentation affected.

Also a problem with OOo 3.4-dev and 3.1.1
Comment 6 Rainer Bielefeld Retired 2011-02-10 22:39:17 UTC
Created attachment 43225 [details]
See  Comment 5

I also can confirm that the problem disappears if lossless export will be unselected.
Comment 7 Rainer Bielefeld Retired 2011-02-11 00:47:21 UTC
I believe it's the same as
<http://www.openoffice.org/issues/show_bug.cgi?id=105441>
Comment 8 gleppert 2011-04-05 12:11:25 UTC
I added "EasyHack" to the Whiteboard assuming that "lossless compression" is exactly the same as "quality set to 100%". 

If this is not the same from a technical point of view, please remove the "EasyHack" tag again. Thanks.

Confirming that the bug is still there in LO 3.3.2 Ubuntu PPA.
Comment 9 Michael Natterer 2011-04-07 01:45:08 UTC
In reponse to comment #8: No, lossless is not the same as lossy with 100%.

I tried to look into this bug as a way to get started with LO hacking,
and because I have experience with image processing, but I'm totally
unable to make the bug happen. I make the simplest possible presentation,
import an image, scale and crop it and export to both lossy and lossless
PDF. Both PDF files look exactly the same, there is no distortion
whatsoever.

I can however reproduce distortion when exporting the attached
Distorted-PDF-Test.odp

Is there anything else than written here I need to do to reproduce this?
Comment 10 Don't use this account, use tml@iki.fi 2011-04-07 01:58:49 UTC
Mitch! Great to see you are still here.

Jean-Baptiste: Note that the JPEG quality scale that the refrence libjpeg implementation uses, that goes from 0 to 100 (with 100 being the best quality) is *not* a percentage. That is an unfortunate misunderstanding, a common misconception. That LO's UI indicates it would be a percentage is a bug.
Comment 11 Michael Natterer 2011-04-07 02:51:23 UTC
Yes, still here ;)

Am I at least on the right track here?
AFAICS the image exporting function is

PDFWriterImpl::implWriteBitmapEx()

in

libs-gui/vcl/source/gdi/pdfwriter_impl2.cxx
Comment 12 gleppert 2011-04-10 11:52:09 UTC
@Michael's comment No. 9.:

In the original bug report, there is nothing else than written here in order to reproduce it. I had the two images in a scanned PDF-document, copied them to the presentation, resized it and had the problem.

Maybe comment 5 by Rainer is helpful in this regard. He has a more simple approach to reproduce the bug.
Comment 13 Björn Michaelsen 2011-12-23 11:45:59 UTC
[This is an automated message.]
This bug was filed before the changes to Bugzilla on 2011-10-16. Thus it
started right out as NEW without ever being explicitly confirmed. The bug is
changed to state NEEDINFO for this reason. To move this bug from NEEDINFO back
to NEW please check if the bug still persists with the 3.5.0 beta1 or beta2 prereleases.
Details on how to test the 3.5.0 beta1 can be found at:
http://wiki.documentfoundation.org/QA/BugHunting_Session_3.5.0.-1

more detail on this bulk operation: http://nabble.documentfoundation.org/RFC-Operation-Spamzilla-tp3607474p3607474.html
Comment 14 sasha.libreoffice 2012-01-18 08:28:07 UTC
I have just tried to reproduce this on Fedora 64 bit in LibO 3.5.0 beta 2
but X server repeatedly crashes. Very strange thing.
 
On Windows XP 32 bit LibO 3.5.0 beta 3 reproduced if choose "Loseless" option:
page 1 in PDF very differs from first page in ODP (file more than 2 MB, can not attach)
Comment 15 sasha.libreoffice 2012-06-15 02:25:22 UTC
*** Bug 47713 has been marked as a duplicate of this bug. ***
Comment 16 Julien Nabet 2012-09-22 23:12:50 UTC
Created attachment 67562 [details]
pdf ok with 3.5 branch

On pc Debian x86-64 with 3.5 branch updated today, I don't reproduce this (see attachment)

gleppert: could you give a try to a newer version (3.5.X or 3.6.X)?
Comment 17 gleppert 2012-09-23 07:28:48 UTC
Created attachment 67571 [details]
Distorted-PDF-Test-tested-with-LO-3.5.4

@Julien: Unfortunately, the bug is still reproducable on my system. Please have a look at today's PDF output attached to this bug. It is still extremely distorted (with lossless compression).

I am using Ubuntu 11.10 with Gnome 3, 64-Bit, LibreOffice 3.5.4.2 Build ID: 350m1(Build:2 from the PPA.
Comment 18 Julien Nabet 2012-09-23 08:50:28 UTC
(In reply to comment #17)
> @Julien: Unfortunately, the bug is still reproducable on my system. Please have
> a look at today's PDF output attached to this bug. It is still extremely
> distorted (with lossless compression).

I retested with 3.6 branch, this time I checked lossless option and I reproduced the pb.
Do you confirm you've also got the problem only if lossless option is checked? If yes, it could be interesting to mention it in the title.
Comment 19 gleppert 2012-09-23 10:09:35 UTC
Yes, the  problem is only there with the (default) option "lossless compression".
I added info in the title of the bug.
Comment 20 bfoman (inactive) 2013-07-26 12:54:19 UTC
Confirmed with:
LO 4.2.0.0.alfa0
Build ID: 2013-06-24 own debug build 
Windows 7 Professional SP1 64 bit

Same result exporting Distorted-PDF-Test.odp with lossless option enabled.
Comment 21 ign_christian 2013-09-10 07:09:51 UTC
*** Bug 69159 has been marked as a duplicate of this bug. ***
Comment 22 ign_christian 2013-09-10 07:13:51 UTC
*** Bug 68144 has been marked as a duplicate of this bug. ***
Comment 23 ign_christian 2013-09-10 07:15:46 UTC
*** Bug 47692 has been marked as a duplicate of this bug. ***
Comment 24 Maxim Monastirsky 2013-09-10 15:01:26 UTC
*** Bug 64719 has been marked as a duplicate of this bug. ***
Comment 25 Maxim Monastirsky 2013-09-10 15:02:32 UTC
*** Bug 47692 has been marked as a duplicate of this bug. ***
Comment 26 dE 2014-05-18 05:25:46 UTC
Reproducible with 4.1.4.2.

Attaching test case.
Comment 27 dE 2014-05-18 05:26:34 UTC
Created attachment 99259 [details]
Test case -- export as PDF.
Comment 28 dE 2014-05-18 05:27:12 UTC
Created attachment 99260 [details]
PDF export result.
Comment 29 Jean-Baptiste Faure 2014-05-19 04:32:17 UTC
(In reply to comment #26)
> Reproducible with 4.1.4.2.
> 
> Attaching test case.

Not reproducible for me with LO 4.2.5.0.0+. Please could you try with the current 4.2.x stable release?

Best regards. JBF
Comment 30 Julien Nabet 2014-05-26 20:22:29 UTC
Put it at NEEDINFO meanwhile.
Comment 31 Jean-Baptiste Faure 2014-07-20 09:24:01 UTC
Works as expected in version 4.2 and future 4.3. Does not work in version 4.1 but version 4.1 having reached its end-of-life no more fixes will be added to this version. So closing as WorksForMe.

Best regards. JBF