Bug 155057 - Wrong colors in some WPG graphic import: WPG1 is well rendered, but not WPG2
Summary: Wrong colors in some WPG graphic import: WPG1 is well rendered, but not WPG2
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
7.3.7.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:7.6.0 target:7.5.4
Keywords:
Depends on:
Blocks: Format-Filters
  Show dependency treegraph
 
Reported: 2023-04-28 01:56 UTC by em36
Modified: 2023-05-03 08:29 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
WPG graphic that opens in Draw with wrong colors (120.33 KB, application/vnd.wordperfect)
2023-04-28 01:56 UTC, em36
Details
screenshot on LO 7.6 (309.70 KB, image/png)
2023-04-28 08:47 UTC, Julien Nabet
Details
Same WPG opened in Corel Presentations X3 (238.45 KB, image/png)
2023-04-28 12:22 UTC, em36
Details
black color in Line properties (217.90 KB, image/png)
2023-04-28 15:37 UTC, BogdanB
Details
The YELOEYE.WPG file converted by Corel app to WPG1 format (95.05 KB, application/vnd.wordperfect)
2023-04-28 18:16 UTC, em36
Details
The WPG1 converted file (YELOONE.WPG) opened in LibreOffice (screenshot) (139.48 KB, image/png)
2023-04-28 18:17 UTC, em36
Details

Note You need to log in before you can comment on or make changes to this bug.
Description em36 2023-04-28 01:56:36 UTC
Created attachment 186973 [details]
WPG graphic that opens in Draw with wrong colors

Some WPG (WordPerfect Graphics) files open with wrong colors in LibreOffice Draw (and also in the libwpg tools that LibreOffice uses for WPG graphics). Here is an example (attached) that has pale pink and orange colors when opened in WordPerfect or Corel Presentations, but dark purple colors in LibreOffice. 

I posted a ticket about this on the libwpg SourceForge page, but no one has responded to it. It would be good if a LibreOffice developer could look into this, as there is no other native software for viewing WPG graphics under Linux or macOS.
Comment 1 em36 2023-04-28 01:57:21 UTC
I should have said that this was one of the graphics that shipped with WordPerfect Office 7 and other versions.
Comment 2 Julien Nabet 2023-04-28 08:47:14 UTC
Created attachment 186974 [details]
screenshot on LO 7.6

Here's what I get on pc Debian x86-64 with master sources updated today.

Would it be possible you attach a screenshot of the expected and what you get to compare?
Comment 3 Julien Nabet 2023-04-28 08:50:56 UTC
Fridrich/David: interested in this one since it concerns libwpg?
Comment 4 em36 2023-04-28 12:22:50 UTC
Created attachment 186983 [details]
Same WPG opened in Corel Presentations X3

Here is the same graphic opened in Corel Presentations X3; it looks exactly the same in the latest version of Presentations (2021(.
Comment 5 em36 2023-04-28 12:24:33 UTC
Comment on attachment 186983 [details]
Same WPG opened in Corel Presentations X3

I forgot to add that what I get under Windows and macOS is exactly the same as the image you posted from Debian.
Comment 6 Julien Nabet 2023-04-28 12:27:20 UTC
Thank you for the feedback, let’s put this one to NEW
Comment 7 em36 2023-04-28 12:29:18 UTC
Sorry - third try: I mean that what I get from LibreOffice in Windows and macOS is exactly the same as what you posted from Debian LibreOffice. I've also built wpg2svg on Windows and macOS, and both give the same wrong colors that you posted from Debian LibreOffice and that I see in Windows and macOS LibreOffice. 

All versions of Corel Presentations and WordPerfect show the correct (mostly light yellow) colors. The name of the WPG (created by Novell or Corel) is YELOEYE, meaning that the fish is a yelloweye rockfish, which looks like this:

https://www.fisheries.noaa.gov/species/yelloweye-rockfish

The colors are correct in Corel's software, but wrong in LibreOffice.
Comment 8 BogdanB 2023-04-28 15:37:52 UTC
Created attachment 186988 [details]
black color in Line properties

If we test the Line properties, it is a black color.
Comment 9 BogdanB 2023-04-28 15:38:28 UTC
Tested in
Version: 7.3.7.2 / LibreOffice Community
Build ID: 30(Build:2)
CPU threads: 16; OS: Linux 5.19; UI render: default; VCL: gtk3
Locale: ro-RO (ro_RO.UTF-8); UI: en-US
Ubuntu package version: 1:7.3.7-0ubuntu0.22.04.2
Calc: threaded
Comment 10 Fridrich Strba 2023-04-28 17:13:43 UTC
It looks like a gradient, which might not be implemented. I will have a quick look.
Comment 11 em36 2023-04-28 18:16:50 UTC
Created attachment 186989 [details]
The YELOEYE.WPG file converted by Corel app to WPG1 format
Comment 12 em36 2023-04-28 18:17:30 UTC
Created attachment 186990 [details]
The WPG1 converted file (YELOONE.WPG) opened in LibreOffice (screenshot)
Comment 13 em36 2023-04-28 18:20:32 UTC
To explain the attachments: I used Corel Presentations Graphic to convert the problem WPG file (which is in WPG2 format) to WPG1 format (the format used by WPDOS 5.1). When I opened the resulting WPG1 file in LibreOffice, the colors were correct. So something seems to be wrong with WPG2 conversion that doesn't apply to WPG1 conversion, but I'm only guessing.
Comment 14 BogdanB 2023-04-29 03:54:46 UTC
WPG1 format from comment 11 opens OK in LibreOffice, the fish is yellow, so it seems we don't suport WPG2 format.
Comment 15 Fridrich Strba 2023-04-29 08:21:24 UTC
https://sourceforge.net/p/libwpg/code/ci/91bd3ecbdf1be5b3c96b706440e45a17b73bdb5f/

And it looks the same in WPG2 and WPG1.
Comment 16 Julien Nabet 2023-04-29 11:07:43 UTC
Thank you Fridrich for the quick fix!

em36: just to sure there's no misunderstanding, after Fridrich's fix, the next steps to wait for are:
1) the release of a new version of libwpg
2) a patch in LO in master sources (= dev branch) to use the release of libwpg
3) a patch in LO in 7.5 branch to use the release of libwpg
4) the LO release of a version from 7.5 branch which includes the patch

About 7.5 branch, here's the schedule https://wiki.documentfoundation.org/ReleasePlan/7.5
Steps 3 and 4 depends on the schedule of libwpg release.
Eg: if the new version libwpg is released in december, it won't be in a 7.5 version of LO since last LO 7.5 is EOL is in november.

(Fridrich: if I'm wrong or if I forgot to tell something important, don't hesitate to tell and also, if you got a release date in mind for new version of libwpg which includes the fix, please share the info ! :-))
Comment 17 Fridrich Strba 2023-04-29 12:27:01 UTC
(In reply to Julien Nabet from comment #16)
> 1) the release of a new version of libwpg

I have done that right now. So, the libwpg-0.3.4 with the fix and some other stuff can be downloaded from the libwpg.sf.net

> 2) a patch in LO in master sources (= dev branch) to use the release of
> libwpg
> 3) a patch in LO in 7.5 branch to use the release of libwpg
> 4) the LO release of a version from 7.5 branch which includes the patch

I let people with the appropriate rights to do it.

For those that use the system libwpg, rebuilding libwpg would be the only thing that is needed.
Comment 18 em36 2023-04-29 14:28:28 UTC
Thank you again for this quick and complete fix! I've built wpg2svg and wpd2odt successfully on macOS and Windows, and the output is now exactly right. (And if you decide to make it possible to build PerfectSpot someday, many of us will be grateful because there is no other separate utility for viewing and converting WPG files.)
Comment 19 Julien Nabet 2023-04-29 18:27:00 UTC
(In reply to Fridrich Strba from comment #17)
> (In reply to Julien Nabet from comment #16)
> > 1) the release of a new version of libwpg
> 
> I have done that right now. So, the libwpg-0.3.4 with the fix and some other
> stuff can be downloaded from the libwpg.sf.net
Great!
>...
> I let people with the appropriate rights to do it.
I got a patch locally, I asked on dev list if someone could upload the file on dev-www.libreoffice.org (see https://lists.freedesktop.org/archives/libreoffice/2023-April/090328.html)
(thanks to this, external/libwpg/rpath.patch can be removed)
Comment 20 Commit Notification 2023-05-02 21:36:36 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/0c0c9a0dd8a7b102315ab1075f78a0f1f3397b67

tdf#155057: Wrong colors in some WPG2 (well rendered in WPG1)

It will be available in 7.6.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 21 BogdanB 2023-05-03 05:09:36 UTC
Julien, thanks for this quick fix.

Now the fish is yellow, as expected.
Verified with
Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 98f766004e29ea35eef6fcf3a4c28696b95f6c90
CPU threads: 16; OS: Linux 5.19; UI render: default; VCL: gtk3
Locale: ro-RO (ro_RO.UTF-8); UI: en-US
Calc: threaded
Comment 22 Commit Notification 2023-05-03 07:57:41 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "libreoffice-7-5":

https://git.libreoffice.org/core/commit/d9db13de3e200841dea75dec9d5c03bf2f8a1c02

tdf#155057: Wrong colors in some WPG2 (well rendered in WPG1)

It will be available in 7.5.4.

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

Affected users are encouraged to test the fix and report feedback.
Comment 23 Julien Nabet 2023-05-03 08:29:49 UTC
(In reply to BogdanB from comment #21)
> Julien, thanks for this quick fix.
You're welcome but the fix comes from Fridrich and Caolán fixed the Boost pb in Jenkins (pb that I hadn't had when building locally), so thank you to them!