Jump to content

Recommended Posts

Hey there everyone,

I'm generating color sets so I don't have to add colors in a new palette manually. However I just figured out that a Affinity color palette (.afpalette) is a binary file.
Would there be a way to import/convert a palette from any kind of text file (xml, json, etc.) that can be generated ?

In comparison Krita does save palette in a custom archive containing text files.

Thanks in advance for your help.

Share this post


Link to post
Share on other sites

Affinity applications can also import .ase files via the Import Palette dialog, and they are (I think) in a plain-text format.


-- Walt

Windows 10 Home, version 2004 (19041.388),
   Desktop: 16GB memory, Intel Core i7-6700K @ 4.00GHz, GeForce GTX 970
   Laptop:  8GB memory, Intel Core i7-3625QM @ 2.30GHz, Intel HD Graphics 4000 or NVIDIA GeForce GT 630M
Affinity Photo 1.8.5.703 and 1.9.0.815 Beta   / Affinity Designer 1.8.5.703 and 1.9.0.815 Beta  / Affinity Publisher 1.8.5.703 and 1.9.0.798 Beta.

Share this post


Link to post
Share on other sites
54 minutes ago, walt.farrell said:

and they are (I think) in a plain-text format.

They are binary but there are tools on the Internet that can convert them to e.g. XML and then back to ASE, to  be imported in Affinity.

EDIT: I cannot check this now, but it seems that there is no way to get XML back to ASE. But see C:\Program Files\Affinity\Publisher\Resources\Pantone (or equivalent on macOS) to examine the .CSV palettes, which is the way Affinity apps read "PANTONE" swatches. I think that you could use this feature to read in any RGB or/and CMYK based named color values saved in a text file as a palette in Affinity apps.

Share this post


Link to post
Share on other sites
35 minutes ago, Lagarto said:

They are binary

Thanks. I misinterpreted something I found via an Internet search.


-- Walt

Windows 10 Home, version 2004 (19041.388),
   Desktop: 16GB memory, Intel Core i7-6700K @ 4.00GHz, GeForce GTX 970
   Laptop:  8GB memory, Intel Core i7-3625QM @ 2.30GHz, Intel HD Graphics 4000 or NVIDIA GeForce GT 630M
Affinity Photo 1.8.5.703 and 1.9.0.815 Beta   / Affinity Designer 1.8.5.703 and 1.9.0.815 Beta  / Affinity Publisher 1.8.5.703 and 1.9.0.798 Beta.

Share this post


Link to post
Share on other sites
2 hours ago, Lagarto said:

They are binary but there are tools on the Internet that can convert them to e.g. XML and then back to ASE, to  be imported in Affinity.

EDIT: I cannot check this now, but it seems that there is no way to get XML back to ASE. But see C:\Program Files\Affinity\Publisher\Resources\Pantone (or equivalent on macOS) to examine the .CSV palettes, which is the way Affinity apps read "PANTONE" swatches. I think that you could use this feature to read in any RGB or/and CMYK based named color values saved in a text file as a palette in Affinity apps.

The Pantone trick seems to be the solution, thanks a lot !

Share this post


Link to post
Share on other sites
On 10/11/2020 at 6:32 AM, Lagarto said:

I found a PHP script that can create ASE binary files from text input:

http://www.colourlovers.com/web/blog/2007/11/08/color-palettes-in-adobe-swatch-exchange-ase

I tested this and the .ase file this script creates can be imported to Affinity apps without problems so this would be an alternative to using the .CSV files.

I tried it as well as it looks promising, however both Photoshop and Affinity say the file is invalid. How did you make it work ?
In the script, function making the ASE content just returns it but doesn't output it to a file, so I've just added a echo before output it to a file : "php ase.php > test.ase".

Share this post


Link to post
Share on other sites
5 hours ago, totjoss said:

In the script, function making the ASE content just returns it but doesn't output it to a file, so I've just added a echo before output it to a file : "php ase.php > test.ase"

The original script misses the script ending tag and he file saving code. You can find them in the attached zip file. 

createasepalette.zip

Here is the resulting test palette:

test.ase

...and when it is imported in Affinity Publisher:

test_ase_palette.jpg.4f51b06131b16d2e696a3e8873d87278.jpg

Share this post


Link to post
Share on other sites

To run the .php script in MacOS:

Download the .zip file from @Lagarto's post above. To your Downloads folder. It should unzip automatically, giving you a file called createasepalette.php.

Launch Terminal.

Type cd Downloads and press Return.

Type php createasepalette.php and press Return.

The .ase file (test.ase) will be written to your Downloads folder.

Quit Terminal.

In Affinity Photo (or any Affinity app), click the Hamburger icon in the Swatches Palette and chose one of the options from Import (Document, Application or System). Navigate to your Downloads folder and choose test.ase.

Result:

771649687_Screenshot2020-10-15at22_27_42.png.2145d8c76381ea59ba0a3fc0c62ac96f.png

Cheers,

H

 


Affinity Photo 1.8.4,  Affinity Designer 1.8.4, Affinity Publisher 1.8.4, Mac OSX 10.15, 2018 MacBook Pro 15"

Betas as they happen... 

Share this post


Link to post
Share on other sites

I created a simple Windows command line utility that can convert RGB and CMYK color definitions along with swatch names saved in a UTF-8 text file to an ASE binary file that can be imported into Affinity apps. I have tested this very little so if you interested, please use at your own risk.

The utility is created primarily for the purpose of creating ASE palettes to be imported in Affinity apps so there is currently no support for grouping of the swatches, nor Lab and Grayscale color definitions, nor is there support for specifying whether a swatch is global, local or spot (all swatches will import as local in Affinity apps).

The notation of colors could easily be enhanced to support direct import of certain specific formats of text-coded palettes. The page at http://www.selapa.net/swatches/colors/fileformats.php#adobe_ase lists some but I do not know if any of the ones documented here would be practical as a universal text-based palette format to be used in these kinds of conversions.

text2ase.zip

 

Share this post


Link to post
Share on other sites
7 hours ago, Lagarto said:

I created a simple Windows command line utility that can convert RGB and CMYK color definitions along with swatch names saved in a UTF-8 text file to an ASE binary file that can be imported into Affinity apps. I have tested this very little so if you interested, please use at your own risk.

The utility is created primarily for the purpose of creating ASE palettes to be imported in Affinity apps so there is no currently support for grouping of the swatches, nor LAB and Grayscale color definitions, nor is there support for specifying whether a swatch is global, local or spot (all swatches will import as local in Affinity apps).

The notation of colors could easily be enhanced to support direct import of certain specific formats of text-coded palettes. The page at http://www.selapa.net/swatches/colors/fileformats.php#adobe_ase lists some but I do not know if any of the ones documented here would be practical as a universal text-based palette format to be used in these kinds of conversions.

text2ase.zip 72.62 kB · 1 download

This is really great Lagarto, thanks for the help !
However I have this error message when I try to execute your utility:

The application to execute does not exist: 'C:\Users\[...]\text2ase\text2ase.dll'.

Did you forget to put the library file ? Also when I first attempt to use it, Windows Defender recommended me to analyse it - maybe it blocked it somehow.

Share this post


Link to post
Share on other sites
1 hour ago, totjoss said:

Did you forget to put the library file ? Also when I first attempt to use it, Windows Defender recommended me to analyse it - maybe it blocked it somehow.

Yep, and the runtime configuration file, as well! Please try again with this one:

text2ase.zip

You might also need the .NET Core 3.1 runtime:

https://dotnet.microsoft.com/download/dotnet-core/3.1

Share this post


Link to post
Share on other sites

Here is the same utlity for macOS (64-bit):

text2ase_macos.zip

The macOS .NET Core Desktop Runtime 3.1.9 can be downloaded from the same address as for Windows:

https://dotnet.microsoft.com/download/dotnet-core/3.1

When you try to access text2ase first time you most probably are not allowed to run it so you need to give it the permission to be run in System Preferences > Security & Privacy tab. Then open Terminal and drag and drop text2ase into an empty command prompt to avoid needing to write paths manually.

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

Please note the Annual Company Closure section in the Terms of Use. These are the Terms of Use you will be asked to agree to if you join the forum. | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.