Jump to content

Recommended Posts

Using PSD.js the colours for text characters don't match RGB,RGBA or CMYK, there are 5 numbers in the a colour arrays, they don't even match the text colour in the photoshop file if you try to compare any of the numbers to the RBG or CMYK values.

An example what PSD.js is showing for colours of a particular part of text shows this array:

[3] => Array
(
[0] => 27
[1] => 185
[2] => 116
[3] => 0
[4] => 255
)

You can clearly see these have no relevance to any colour codes I have seen before. These numbers are supposedly representing this colour: #db6971 - but none of the numbers match anything, the RGB for that is 219,105,113 and CMYK is 11%,72%,46%,0%

So does anyone have a clue what is going on here? I am trying to render this text to html but I can't set the colour without actually knowing what these numbers are supposed to mean.

Can't get an answer from the library developer on this.

Link to comment
https://forums.phpfreaks.com/topic/306636-psdjs-font-colour-codes-make-no-sense/
Share on other sites

Was that off the top of your head, or did you read more of the code than I did?

I just noticed there was a correlation between the 27/185/116/0 and the 11%/72%/46%/0%. PSDs are primarily about printing so CYMK would be more appropriate than RGB.

The final 255 could easily be alpha/opacity.

 

The true answer is probably buried somewhere in the PSD spec but it's not the easiest thing to read through.

  • Like 1

Again, nice work. I read some of the source for PSD.js at Github and had figured it was CMYK because that array had 5 elements, but the values in the CoffeeScript there were still all 8-bit based and I didn't have time to track down through the rest of the system to see how the math worked ...

Edited by dalecosp
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

×
×
  • Create New...

Important Information

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.