Bug 98421 - PDFIMPORT Images are imported into Writer rotated and mirrored (see comment 9)
Summary: PDFIMPORT Images are imported into Writer rotated and mirrored (see comment 9)
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
5.1.0.3 release
Hardware: All Windows (All)
: medium normal
Assignee: Mike Kaganski
URL:
Whiteboard: target:5.2.0 target:5.1.2
Keywords: regression
Depends on:
Blocks:
 
Reported: 2016-03-04 17:44 UTC by ZioTibia81
Modified: 2016-10-25 19:08 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
PDF with and image (12.37 KB, application/x-download)
2016-03-04 17:44 UTC, ZioTibia81
Details
Result of import (17.93 KB, application/vnd.oasis.opendocument.graphics)
2016-03-04 17:44 UTC, ZioTibia81
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ZioTibia81 2016-03-04 17:44:01 UTC
Created attachment 123295 [details]
PDF with and image

This error wasn't present in version 5.0, I found it only in 5.1

- Take a pdf with an image (test.pdf attached)
- Open it with Draw
- The image is imported but at wrong position, rotated by 180° and mirrored
Comment 1 ZioTibia81 2016-03-04 17:44:43 UTC
Created attachment 123296 [details]
Result of import
Comment 2 raal 2016-03-04 19:33:37 UTC
I can not confirm with Version: 5.2.0.0.alpha0+
Build ID: aaca25d67eb5ea252730cdcf555ecc04ce04a5e6
CPU Threads: 4; OS Version: Linux 4.2; UI Render: default; 
TinderBox: Linux-rpm_deb-x86_64@70-TDF, Branch:master, Time: 2016-02-24_23:58:47

Seems to be fixed in dev version. Please could you test with dev version?
http://dev-builds.libreoffice.org/daily/master/
Thank you
Comment 3 V Stuart Foote 2016-03-04 21:12:21 UTC
Confirming 5.1.1 rc2 and a current master

On Windows 8.1 Ent 64-bit en-US with imagemagick and gs on path

with
Version: 5.1.1.2 (x64)
Build ID: fe4d9e69c82c6ee6db3c27cd5e2d47558afa80ac
CPU Threads: 8; OS Version: Windows 6.29; UI Render: default; 
Locale: en-US (en_US)

and with
Version: 5.2.0.0.alpha0+
Build ID: 7ccdb94e2c5774f924bf89b34387c7d41e2e4c30
CPU Threads: 8; OS Version: Windows 6.29; UI Render: GL; 
TinderBox: Win-x86@39, Branch:master, Time: 2016-03-03_02:40:45
Locale: en-US (en_US)

The filter import of the PDF to Draw looks to be performing a vertical flip of the embedded PNG.  And, same errant filter action on import to Writer.

@Mike K., Armin, wasn't something more needed for the work on bug 96993, is the vertical mirror somehow still needed?
Comment 4 V Stuart Foote 2016-03-04 21:14:22 UTC
(In reply to V Stuart Foote from comment #3)

> @Mike K., Armin, wasn't something more needed for the work on bug 96993, is
> the vertical mirror somehow still needed?

Sorry, that reads wrong... 

s/wasn't/is/
Comment 5 Mike Kaganski 2016-03-04 22:51:01 UTC
(In reply to V Stuart Foote from comment #3)
> The filter import of the PDF to Draw looks to be performing a vertical flip
> of the embedded PNG.  And, same errant filter action on import to Writer.
> 
> @Mike K., Armin, wasn't something more needed for the work on bug 96993, is
> the vertical mirror somehow still needed?

It looks like that. Seems that I ignored some special case. I'll fix that asap, and create a unittest for this. Now I actually expect other cases to come.
Sorry for inconvenience.
Comment 6 V Stuart Foote 2016-03-04 22:59:48 UTC
(In reply to Mike Kaganski from comment #5)

> ... inconvenience.

Not at all! Very happy to have you engaged!

Just hope we can move Armin's aw80 object refactoring rework along to finally get these type issue under control.
Comment 7 Mike Kaganski 2016-03-05 02:44:26 UTC
(In reply to raal from comment #2)
> I can not confirm with Version: 5.2.0.0.alpha0+
> Build ID: aaca25d67eb5ea252730cdcf555ecc04ce04a5e6
> CPU Threads: 4; OS Version: Linux 4.2; UI Render: default; 
> TinderBox: Linux-rpm_deb-x86_64@70-TDF, Branch:master, Time:
> 2016-02-24_23:58:47


(In reply to V Stuart Foote from comment #3)
> Confirming 5.1.1 rc2 and a current master

Hi guys,
are you positive that this is reproducible under those versions?
because I cannot reproduce it with any of below.

*Win10x64*:
===========
Version: 5.1.1.1 (x64)
Build ID: c43cb650e9c145b181321ea547d38296db70f36e
CPU Threads: 4; OS Version: Windows 6.19; UI Render: default; 
Locale: ru-RU (ru_RU)

Version: 5.1.1.3 (x64)
Build ID: 89f508ef3ecebd2cfb8e1def0f0ba9a803b88a6d
CPU Threads: 4; OS Version: Windows 6.19; UI Render: default; 
Locale: ru-RU (ru_RU)

*Ubuntu 14.04 x64*:
===================
Version: 5.1.1.2
Build ID: 1:5.1.1~rc2-0ubuntu1~trusty0
CPU Threads: 2; OS Version: Linux 3.19; UI Render: default; 
Locale: en-US (en_US.UTF-8)
Comment 8 V Stuart Foote 2016-03-05 05:07:14 UTC
@Mike,

So at home on a Windows 10 Pro 64-bit en-US system with
Version: 5.2.0.0.alpha0+
Build ID: fee4fe8e589e101140d9b318ac757825bf836506
CPU Threads: 8; OS Version: Windows 6.19; UI Render: GL; 
TinderBox: Win-x86@39, Branch:master, Time: 2016-03-04_03:16:28
Locale: en-US (en_US)

Opening to Draw on this system is correct. So, I remoted back to my other system at work and checked again there, and it is correct.  I think I must have screwed up and opened OPs 5.1.0.3 generated .ODG in Draw, rather than the PDF.

Checked on both, and the PDF import into Impress is also correct with 5.1.1.3 and 5.2.0alppha1+

However--on both systems, when PDF is imported into Writer with 5.1.1 or master, that filter still does have the import filter issue.

STR

1. set LibreOffice to use LibreOffice dialogs
2. open file dialog
3. select the test PDF
4. set File type dropdown to "PDF - Portable Document Format (Writer) (*.pdf)
5. open

result: the Test image is rotated 180 and reversed, still emulating the vertical flip issue.

So, I think I was wrong--the default Open into Draw *IS* corrected for 5.1.1 and master. As is the import into Impress.  Just the import into Writer filter still needs a tweak.  I am sorry.
Comment 9 Mike Kaganski 2016-03-05 09:44:44 UTC
Ok, so this issue was filed as clear duplicate of bug 96993. it turns out that Draw part (which it was filed against) if indeed fixed in 5.1.1.

V Stuart Foote in comment 3 discovered that Writer part is still broken.

Let's not close this as dupe, but use it to track Writer import issue. Changed description accordingly.

@OP: Please check if the initial issue (against Draw) is solved in 5.1.1.3 for you. Thank you for reporting! Every report helps us together make a better LO.
Comment 10 ZioTibia81 2016-03-07 10:17:01 UTC
I can confirm that PDF Import in Draw is correct in 5.1.1.3
Comment 11 Mike Kaganski 2016-03-08 11:42:50 UTC
Posted a patch to gerrit: https://gerrit.libreoffice.org/23028
Comment 12 Commit Notification 2016-03-09 10:22:59 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

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

tdf#98421: properly import vertical mirroring of images from PDF

It will be available in 5.2.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 13 Mike Kaganski 2016-03-09 10:45:53 UTC
Backport ot 5-1 is pending: https://gerrit.libreoffice.org/23063/
Comment 14 Commit Notification 2016-03-09 14:23:37 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-5-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=9fb382d4e6afd40f8c50981cac3cbea9334b5639&h=libreoffice-5-1

tdf#98421: properly import vertical mirroring of images from PDF

It will be available in 5.1.2.

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.