Bug 135561 - Extend Adobe .ase colour palette support
Summary: Extend Adobe .ase colour palette support
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: graphics stack (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-08-08 17:00 UTC by Volga
Modified: 2024-09-11 15:36 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volga 2020-08-08 17:00:27 UTC
Description:
Although we have already got this support (bug 84002), it's still necessary to add some improves to give better support for this format. FreieFarbe e.V. published the CIELAB HLC Colour Atlas (XL), a free standard for color communication. On the website they provided some ASE palettes, however both of them failed on LibreOffice.
https://www.freiefarbe.de/en/thema-farbe/software/

Steps to Reproduce:
1. Download ZIP package from freiefarbe
2. Extract ASE palettes
3. Move to LibreOffice user configuration folder

Actual Results:
While the ASE palettes installed, all of them failed to produce colors, but show rather blocks in black.

Expected Results:
-


Reproducible: Always


User Profile Reset: No



Additional Info:
-
Comment 1 Julien Nabet 2020-08-09 09:10:28 UTC
ASE is not documented officially but it seems it supports several types of colour spaces:
- RGB
- LAB
- CMYK
- Grayscale
See https://www.cyotek.com/blog/reading-adobe-swatch-exchange-ase-files-using-csharp

I gave a try with HLC-Colour-Atlas_EPV_Swatches_v2-3.ase and could reproduce this on pc Debian x86-64 with master sources updated today. But this palette contains "LAB" colour space and this one isn't supported.
See
https://opengrok.libreoffice.org/xref/core/svx/source/tbxctrls
/Palette.cxx?r=33966ab2#161

Chris/Tomaz: any thoughts here?
Comment 2 Tomaz Vajngerl 2020-08-10 06:14:18 UTC
Yes, we need to add the code to convert from other colorspaces to RGB as we only handle RGB (and grayscale).
Comment 3 Julien Nabet 2020-08-10 17:23:45 UTC
(In reply to Tomaz Vajngerl from comment #2)
> Yes, we need to add the code to convert from other colorspaces to RGB as we
> only handle RGB (and grayscale).

yes but I read several links and the only thing that's sure is it needs a 2-steps conversion:
- convert LAB to XYZ
- convert XYZ to RGB
See http://www.brucelindbloom.com/index.html?Equations.html

For the rest, formula, coefficients may differ. It also depends on parameters like "white point" and other elements that I don't know.
See:
- https://en.wikipedia.org/wiki/CIELAB_color_space#RGB_and_CMYK_conversions
- http://www.brucelindbloom.com/index.html?Equations.html
...
Not easy...

Another thing I noticed too, according to https://www.cyotek.com/blog/reading-adobe-swatch-exchange-ase-files-using-csharp, nChunkType should be 2 bytes and nChunkSize 4 bytes. In LO codes, it's the contrary.
Comment 4 QA Administrators 2022-08-11 03:46:56 UTC Comment hidden (obsolete)
Comment 5 QA Administrators 2024-08-11 03:15:07 UTC Comment hidden (obsolete)
Comment 6 Volga 2024-08-11 15:48:48 UTC
(In reply to Tomaz Vajngerl from comment #2)
> Yes, we need to add the code to convert from other colorspaces to RGB as we
> only handle RGB (and grayscale).
I think one solution is implementing color management to make use of ICC color profile to build a bridge between RGB and other color models.
Comment 7 Commit Notification 2024-08-14 11:39:19 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/53730cc3b0a6b0228f680962f79ae6bec9e7fe02

Related tdf#135561: read ase palette with Lab colormodel

It will be available in 25.2.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 8 Julien Nabet 2024-08-14 11:43:32 UTC
Before cherry-picking the patch on 24.8 branch, it would be great someone confirms that the converted Lab colors to RGB are ok.
Comment 9 Volga 2024-08-16 12:41:32 UTC Comment hidden (no-value)
Comment 10 Volga 2024-08-16 13:06:57 UTC
Sorry, it doesn't work at all. Maybe I have to waiting for a so long time until I'm able to confirm.
Comment 11 Julien Nabet 2024-08-16 13:41:16 UTC
(In reply to Volga from comment #10)
> Sorry, it doesn't work at all. Maybe I have to waiting for a so long time
> until I'm able to confirm.

You mean it's still black for you or do you some colors and you consider them as wrong?
Comment 12 Volga 2024-08-16 16:01:52 UTC Comment hidden (no-value)
Comment 13 Volga 2024-08-17 04:38:32 UTC
(In reply to Julien Nabet from comment #11)
> You mean it's still black for you or do you some colors and you consider
> them as wrong?
They still looks black.

Version: 24.2.6.0.0+ (X86_64) / LibreOffice Community
Build ID: 525fe1a2e58a4d6164aa104e893d4f07a5709b27
CPU threads: 4; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: zh-CN (zh_CN); UI: zh-CN
Calc: CL threaded

https://freiefarbe.de/wp-content/uploads/2022/12/HLC-Colour-Atlas_EPV_A10_v2.03.zip
Comment 14 Julien Nabet 2024-08-17 08:03:49 UTC
(In reply to Volga from comment #13)
> (In reply to Julien Nabet from comment #11)
> > You mean it's still black for you or do you some colors and you consider
> > them as wrong?
> They still looks black.
> 
> Version: 24.2.6.0.0+ (X86_64) / LibreOffice Community
> Build ID: 525fe1a2e58a4d6164aa104e893d4f07a5709b27
> CPU threads: 4; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL:
> win
> Locale: zh-CN (zh_CN); UI: zh-CN
> Calc: CL threaded
> 
> https://freiefarbe.de/wp-content/uploads/2022/12/HLC-Colour-Atlas_EPV_A10_v2.
> 03.zip

The patch concerns only master branch for the moment, so the future 25.2.
So indeed, it won’t work on 24.2.6
Comment 15 Volga 2024-08-17 17:43:00 UTC
It still doesn't work with me.

Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 612e4d7731cc2890d6e58e8b712757fccd06ae2d
CPU threads: 4; OS: Windows 10 X86_64 (10.0 build 19045); UI render: Skia/Raster; VCL: win
Locale: zh-CN (zh_CN); UI: en-US
Calc: CL threaded
Comment 16 Julien Nabet 2024-08-19 13:48:27 UTC
I won't have access to my Windows laptop so can't help here.
Let's remove target, unassign + uncc myself
Comment 17 Volga 2024-08-22 07:00:57 UTC
I believe integrating LittleCMS would help
Comment 18 Julien Nabet 2024-09-07 17:32:07 UTC
I retrieved my Windows laptop and could give a try today, I confirm there's only black for each entry of the ASE palette.
I retried the ase file on Linux and I don't reproduce this.

I tested on Windows if LO entered in the code modified by the patch, it was the case.
So no idea, why it fails on Windows.

About LittleCMS, I got no idea.
I know that license of the lib must be checked before integrating it but don't know how to integrate in LO code.
Certainly someone may have some idea here.
Comment 19 Volga 2024-09-11 15:36:56 UTC
(In reply to Julien Nabet from comment #18)
> About LittleCMS, I got no idea.
> I know that license of the lib must be checked before integrating it but
> don't know how to integrate in LO code.
> Certainly someone may have some idea here.
Here is some information about LittleCMS:
https://www.littlecms.com/
Yeah this is the solution I have claimed in comment 6 and 17. Using this library to replace comment 53730cc3b0a6b0228f680962f79ae6bec9e7fe02 would pave the way to support ASE palettes in various color models, and LO could be able to reproduce even more desirable output.