Bug 88465 - FILEOPEN PDF Import: incorrect image transformations
Summary: FILEOPEN PDF Import: incorrect image transformations
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
4.4.0.0.alpha0+ Master
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:4.5.0 target:4.4.5
Keywords: filter:pdf
: 84337 99811 (view as bug list)
Depends on: 48342
Blocks: PDF-Import-Draw Draw-Images
  Show dependency treegraph
 
Reported: 2015-01-15 16:01 UTC by vvort
Modified: 2021-03-01 12:18 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Test PDF (187.58 KB, application/pdf)
2015-01-15 16:01 UTC, vvort
Details
Test SVG (source file; linked to e:\logo.png) (6.90 KB, image/svg+xml)
2015-01-15 16:02 UTC, vvort
Details
Screenshot (LO.Draw vs Adobe Reader) (497.92 KB, image/png)
2015-01-15 16:03 UTC, vvort
Details
Patch v1 (9.27 KB, patch)
2015-01-16 14:07 UTC, vvort
Details
Render of half-fixed image transforms (627.61 KB, image/png)
2015-01-18 14:27 UTC, vvort
Details
PDF tested on LO Draw, missing some text when compared to view from pdf reader (467.85 KB, application/pdf)
2016-07-07 19:03 UTC, freshproductive
Details
LOO 5.4.2.1 64 bit in win 10 64 bit pdf export (1.14 MB, application/pdf)
2017-09-20 23:56 UTC, paulystefan
Details
screenshot 5.4.2.1-64 win10-64 (219.60 KB, image/png)
2017-09-20 23:57 UTC, paulystefan
Details

Note You need to log in before you can comment on or make changes to this bug.
Description vvort 2015-01-15 16:01:09 UTC
Created attachment 112305 [details]
Test PDF

Image scaling, rotating, shearing - all of these are problems for current PDF import code.
Test files and screenshot are attached.
Comment 1 vvort 2015-01-15 16:02:22 UTC
Created attachment 112306 [details]
Test SVG (source file; linked to e:\logo.png)
Comment 2 vvort 2015-01-15 16:03:31 UTC
Created attachment 112307 [details]
Screenshot (LO.Draw vs Adobe Reader)
Comment 3 vvort 2015-01-16 14:07:39 UTC
Created attachment 112343 [details]
Patch v1

Here is the first version of the patch.
It fixes Bug 88049 and partially fixes this bug (88465).
Comment 4 Buovjaga 2015-01-16 14:50:36 UTC
(In reply to vvort from comment #3)
> Created attachment 112343 [details] [review]
> Patch v1
> 
> Here is the first version of the patch.
> It fixes Bug 88049 and partially fixes this bug (88465).

You should send it to gerrit and reference the issues. Patches in BZ get lost.
Comment 5 vvort 2015-01-16 16:43:32 UTC
OK, I've sent it.
https://gerrit.libreoffice.org/13957

But here is some notes:
1. This commit changes the way how transformations are processed; Because of this, many things must be tested and checked for regressions: text, polygons and images.
2. Skew transformations are not fixed: bug lies somewhere deep in LO code: maybe even in specifications (look at https://wiki.openoffice.org/wiki/User:Regina/MYDrafts4 ).
Comment 6 Robinson Tryon (qubit) 2015-01-16 17:03:59 UTC
(In reply to vvort from comment #0)
> Image scaling, rotating, shearing - all of these are problems for current
> PDF import code.

REPRO Steps:
- Open attachment 112305 [details] (test PDF) in Draw
- Compare to renderings of LO and Adobe Reader in attachment 112307 [details]


TESTING with LO 4.4.0.2 + Ubuntu 14.04

CONFIRMED: image transforms are wildly/incorrectly skewed compared to how the document renders in Adobe Reader and in Firefox 34.0

Status -> NEW
Whiteboard -> filter:pdf
Comment 7 vvort 2015-01-18 14:27:30 UTC
Created attachment 112423 [details]
Render of half-fixed image transforms

Hello, all.

I have created utils for regression testing of pdf import-export filters.
They are limited to Windows' batch language, but can be easily ported to *nix.
Additionally to libreoffice installation, Poppler's pdftocairo.exe and ImageMagick's compare.exe are needed.

Here they are:
generate.bat:
@echo off
set pdf_to_png=d:\poppler\bin\pdftocairo.exe
set libre_office=e:\_Projects\libreoffice-build\instdir\program\soffice.exe
set search_path=original\*.pdf
if not "%1" == "" set search_path=original\%1
for %%f in (%search_path%) do (
  echo Processing: %%~nf.pdf
  if not exist original\%%~nf.png (
    %pdf_to_png% -singlefile -png original\%%~nf.pdf 2>nul
  )
  %libre_office% --convert-to odf --outdir libreoffice original\%%~nf.pdf
  %libre_office% --convert-to pdf --outdir libreoffice libreoffice\%%~nf.odf
  %pdf_to_png% -singlefile -png libreoffice\%%~nf.pdf 2>nul
)

compare.bat:
@echo off
set cmp_path1=libreoffice-master
set cmp_path2=libreoffice
set cmp_path3=diff
set im_compare=d:\ImageMagick\compare
mkdir diff 2>nul
for %%f in (libreoffice-master\*.png) do (
  echo Comparing: %%~nf.png
  %im_compare% %cmp_path1%\%%~nf.png %cmp_path2%\%%~nf.png %cmp_path3%\%%~nf.png
)

And I have tested this test utils on gerrit commit #13957 with 23 different PDF files: no regressions was found.

Also render result for image_transforms.pdf with latest commit attached.
Comment 8 Commit Notification 2015-01-19 12:54:31 UTC
Vort committed a patch related to this issue.
It has been pushed to "master":

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

fdo#88465 PDF Import: fix scale and rotate image transformations

It will be available in 4.5.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 9 Commit Notification 2015-07-07 16:05:49 UTC
Vort committed a patch related to this issue.
It has been pushed to "libreoffice-4-4":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=470eaff4ddbadb26b7c3d524d351508e984ce878&h=libreoffice-4-4

fdo#88465 PDF Import: fix scale and rotate image transformations

It will be available in 4.4.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 10 Robinson Tryon (qubit) 2015-12-03 11:04:04 UTC
Converting Whiteboard tags to Keywords: filter:pdf
Comment 11 Heiko Tietze 2016-05-10 08:58:13 UTC
Rotation looks good. But the placement is not correct and all images are mirrored.
Comment 12 Heiko Tietze 2016-05-10 10:01:27 UTC
*** Bug 84337 has been marked as a duplicate of this bug. ***
Comment 13 Heiko Tietze 2016-05-13 09:33:48 UTC
*** Bug 99811 has been marked as a duplicate of this bug. ***
Comment 14 Jouni Järvinen 2016-05-13 12:03:28 UTC
Here's copypaste of #99811:

Decided to give a go for several PDF's with Draw 5.1.3.1 x64, the latest at this time. The PDF's are freely available:

- http://it-ebooks.info/book/1463046616/
- http://it-ebooks.info/book/1463046483/ 
- http://it-ebooks.info/book/1463046723/
- http://it-ebooks.info/book/1463047378/
- http://it-ebooks.info/book/1463047188/

1) In some files the first page is brutally stretched from the middle all the way to the bottom, exceeding the seeable view without zooming out radically.

2) Texts are misplaced mindlessly.

3) Where Draw shows some sort of transparent box, the shape of the box can be just anything.

3.2) Related to 2, the texts and objects are, usually, misplaced mindlessly.

The mentioned points happen with almost every PDF from the site.
Comment 15 vvort 2016-05-13 13:12:44 UTC
I wasn't able to download books from specified URLs. After pressing download button, web page just refreshes, popping another bunch of ads.
Comment 17 vvort 2016-05-13 14:54:28 UTC
There are many font, kerning and clipping problems in this files, but I think they are not related to this report.
Only one thing is left unfixed in the scope of this report: incorrect skew transformations of the images, but this is a rare case in real PDF files.
Comment 18 Jouni Järvinen 2016-05-13 15:42:07 UTC
(In reply to vvort from comment #17)
> There are many font, kerning and clipping problems in this files, but I
> think they are not related to this report.
> Only one thing is left unfixed in the scope of this report: incorrect skew
> transformations of the images, but this is a rare case in real PDF files.

#99811 was closed as dupe of this one.
Comment 19 Buovjaga 2016-05-13 16:06:31 UTC
(In reply to Jouni Järvinen from comment #18)
> (In reply to vvort from comment #17)
> > There are many font, kerning and clipping problems in this files, but I
> > think they are not related to this report.
> > Only one thing is left unfixed in the scope of this report: incorrect skew
> > transformations of the images, but this is a rare case in real PDF files.
> 
> #99811 was closed as dupe of this one.

Your report had several issues. Did you review this list, like Heiko suggested: https://bugs.documentfoundation.org/showdependencytree.cgi?id=99746&hide_resolved=1
Comment 20 Jouni Järvinen 2016-05-13 16:11:38 UTC
(In reply to Buovjaga from comment #19)
> (In reply to Jouni Järvinen from comment #18)
> > (In reply to vvort from comment #17)
> > > There are many font, kerning and clipping problems in this files, but I
> > > think they are not related to this report.
> > > Only one thing is left unfixed in the scope of this report: incorrect skew
> > > transformations of the images, but this is a rare case in real PDF files.
> > 
> > #99811 was closed as dupe of this one.
> 
> Your report had several issues. Did you review this list, like Heiko
> suggested:
> https://bugs.documentfoundation.org/showdependencytree.
> cgi?id=99746&hide_resolved=1

I must be missing something cuz I can't find such suggestions anywhere, and I had absolutely no clue about existence of such dependency tree.
Comment 21 Buovjaga 2016-05-13 16:23:25 UTC
(In reply to Jouni Järvinen from comment #20)
> I must be missing something cuz I can't find such suggestions anywhere, and
> I had absolutely no clue about existence of such dependency tree.

https://bugs.documentfoundation.org/show_bug.cgi?id=99811#c1
Comment 22 Jouni Järvinen 2016-05-13 16:29:38 UTC Comment hidden (off-topic)
Comment 23 freshproductive 2016-07-07 19:03:03 UTC Comment hidden (off-topic)
Comment 24 freshproductive 2016-07-07 19:06:47 UTC Comment hidden (off-topic)
Comment 25 Buovjaga 2016-07-07 19:24:15 UTC Comment hidden (off-topic)
Comment 26 paulystefan 2017-09-20 23:56:18 UTC
Created attachment 136413 [details]
LOO 5.4.2.1 64 bit in win 10 64 bit pdf export

looks all ok in my view
Comment 27 paulystefan 2017-09-20 23:57:52 UTC
Created attachment 136414 [details]
screenshot 5.4.2.1-64 win10-64

looks good in LOO 5.4.2.1
Comment 28 vvort 2017-09-21 05:34:02 UTC
(In reply to paulystefan from comment #27)
> looks good in LOO 5.4.2.1

No, not good.
Look at bottom 6 images.
Their shapes should be horizontally symmetrical.
Comment 29 paulystefan 2017-11-27 21:04:42 UTC
you are right, bottom 6 are false in directions
Comment 30 paulystefan 2017-11-27 21:05:16 UTC
also in 5.4.3.2 x64 win10
Comment 31 paulystefan 2018-06-22 16:44:54 UTC
also in 6.0.5.1 x64 win10

bottom 6 are false in directions
Comment 32 paulystefan 2018-08-25 11:14:38 UTC
also in 6.1.0.3 x64 win10

6 at bottom  are false in directions
Comment 33 paulystefan 2019-08-23 21:35:12 UTC
also in 6.3.0.4 x64 win10

6 at bottom  are false in directions
Comment 34 Svatopluk Vít 2021-03-01 09:55:44 UTC
Unable to even open the file, I get 

General Errror - General Input/Output Error

Tested with Inkscape 1.0.2, I can see the file correctly (I downloaded also LO logo.png to be able to see the result)

In present LO version I am unable to see anything.

Version: 7.1.1.1 (x64) / LibreOffice Community
Build ID: 575c5867c4cc13d7ae78f9ce39a54a52ed38c769
CPU threads: 4; OS: Windows 10.0 Build 19042; UI render: Skia/Vulkan; VCL: win
Locale: cs-CZ (cs_CZ); UI: en-GB
Calc: threaded

The same for Linux version

Version: 7.1.1.1 / LibreOffice Community
Build ID: 575c5867c4cc13d7ae78f9ce39a54a52ed38c769
CPU threads: 8; OS: Linux 5.10; UI render: default; VCL: kf5
Locale: cs-CZ (cs_CZ.UTF-8); UI: cs-CZ
Calc: threaded
Comment 35 Buovjaga 2021-03-01 12:18:58 UTC
Opens fine in 7.2 and what is best, it matches the Adobe Reader screenshot perfectly!

Arch Linux 64-bit
Version: 7.2.0.0.alpha0+ / LibreOffice Community
Build ID: e5f436bc53e0d07654901ef7cc8ff56d04f0686e
CPU threads: 8; OS: Linux 5.11; UI render: default; VCL: kf5
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: threaded
Built on 24 February 2021