Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Files do not work in illustrator #14

Open
someguy9 opened this issue Dec 27, 2022 · 7 comments
Open

Files do not work in illustrator #14

someguy9 opened this issue Dec 27, 2022 · 7 comments

Comments

@someguy9
Copy link

Very odd the .ASE files work perfectly in Photoshop but not in Illustrator sadly. Is anyone else having this issue?

@jlarmstrongiv
Copy link

jlarmstrongiv commented May 21, 2023

I have the same issue. I exported the sketch-default.sketchpalette as an .ase file from the demo. It opens perfectly in Adobe PhotoShop and Affinity Software, but is empty in Adobe Illustrator and errors in Adobe InDesign.

Photoshop:
image

Affinity Designer:
image

Illustrator:
image

InDesign:
image

@jlarmstrongiv
Copy link

Not really sure how to debug this error. But, if you have any ideas or other files, I’d be glad to test them

@jlarmstrongiv
Copy link

jlarmstrongiv commented May 21, 2023

In the meantime, I have confirmed these other libraries works in Adobe Illustrator and Adobe InDesign:

@peteroupc
Copy link

I believe the code that writes to '.ASE' format is faulty:

https://github.com/1j01/anypalette.js/blob/eaf17cca78203bf2e68298137859f3f23cc46520/src/formats/Adobe.coffee#L328C2-L331C33

view.writeString("ASEF")
view.writeUint32(1) # version
view.writeUint32(blocks.length)

Which should probably be:

view.writeString("ASEF")
view.writeUint16(1) # version
view.writeUint16(0) # version
view.writeUint32(blocks.length)

This might not be the only issue with the '.ASE' writing code.

@1j01
Copy link
Owner

1j01 commented Jun 11, 2024

One general strategy to test this would be to load a known-good .ASE file in anypalette.js and save it as .ASE and compare the files to see what's different. Of course this may be difficult since it's a binary format, and there may be many unimportant differences to address before any important difference is detected (depending on the complexity of the format).
One could write a Kaitai Struct definition for ASE in order to help with this analysis. That in itself would be tedious, but maybe ChatGPT (or another LLM) can help with it, giving it a format specification document and/or parser source code to work off of. Edit: Wait, actually I already did this work! There are .ksy files in this repo, including for ASE.

Not saying this would be the best way to go about it. Might be easier to compare across library code, since @jlarmstrongiv pointed to some working libraries.

@peteroupc This strikes me as likely-equivalent code. It depends on the byte ordering, but the bit representation of 1 in Uint16 vs Uint32 is the same, right? Other than the number of 0 bits?

@peteroupc
Copy link

@peteroupc This strikes me as likely-equivalent code. It depends on the byte ordering, but the bit representation of 1 in Uint16 vs Uint32 is the same, right? Other than the number of 0 bits?

Assuming writeUint16 and writeUint32 are big-endian, as it appears to be—

  • the first code block writes the bytes 'A','S','E','F',0,0,0,1, then blocks.length in big-endian.
  • the second code block writes the bytes 'A','S','E','F',0,1,0,0, then blocks.length in big-endian.

In fact, although GIMP supports the .ASE format, files currently generated by Anypalette appear to cause GIMP to crash.

@1j01
Copy link
Owner

1j01 commented Jun 11, 2024

@peteroupc You're right. This does seem to be a difference in the output of the anypalette.js compared to the palette files I have.
I've updated the code to use writeUint16.

Does this new output work in Illustrator and InDesign? I confirmed it works in GIMP and that it crashes on the old output.
I had to put it in a ZIP file to upload to GitHub:
CSS3_named_colors.new-ase-output.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants