• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Photoshop psd spec "psfl"

New Here ,
Jun 18, 2017 Jun 18, 2017

Copy link to clipboard

Copied

Hi Photoshop experts,

I'm trying to read a psd file in my app and came across a point in the spec I do not understand.

I'm referring to the psd file format spec.

Specifically, I'm trying to read the "psfl" photo filter information from the additional layer information section of the file.

The spec states:

"4 bytes each for XYZ color (Only in Version 3)"

The spec doesn't say in what format these color components are stored.

So I've tried reading this as Uint32, Float32 but neiter of these formats yields a value that make sense.

I think the XYZ components should be floating point values.

For example RGB (0.0,1.0,0.0) should be XYZ (0.385065, 0.716879, 0.097105) - using this color calculator

Could someone tell in what format these components are stored?

Thanks for your help

Martin

Views

297

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jun 18, 2017 Jun 18, 2017

Votes

Translate

Translate
Adobe
Community Expert ,
Jun 18, 2017 Jun 18, 2017

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 19, 2017 Jun 19, 2017

Copy link to clipboard

Copied

LATEST

Hi and thanks for your pointers.

I took a look at python psd-tools before - they seem to just skip this part.

Then - I took look at libpsd .. they shift-right the resulting uint32 for 8 bits.

// 4 bytes each for XYZ color

data->x_color = psd_stream_get_int(context) >> 8;

data->y_color = psd_stream_get_int(context) >> 8;

data->z_color = psd_stream_get_int(context) >> 8;

However when I do so I'm getting XYZ=(51,91,15) for RGB=(0.0,1.0,0.0).

As "Test Screen Name" mentions the value could be fixed point - so I gave that a try.

There are several options to represent a fixed point number in 32 bits. I've tried an online converter

Fixed Point Converter | Byte Craft Limited - here are the results.

This is the value I'm trying to read out - 100% green.

-> RGB (0.0,1.0,0.0)

With lindbloom's converter (sRGB and D50 white point) I get:

X 0.385065

Y 0.716879

Z 0.097105

The fixed point converter yields these:

format = "fract8"

X 0x00003320 -> 0.3984375

Y 0x00005BC3 -> 0.7109375

Z 0x00000F0F -> 0.1171875

format = "_Fract"

X 0x00003320 -> 0.3994140625

Y 0x00005BC3 -> 0.716888427734375

Z 0x00000F0F -> 0.117645263671875

format = fract24

X 0x00003320 -> 0.3994140625

Y 0x00005BC3 -> 0.716888427734375

Z 0x00000F0F -> 0.117645263671875

Pretty close - I'm not sure if there's some difference in the color space conversion or if it's another fixed point format.

Any ideas why they just didn't put an ordinary float32 there if there is plenty of space!?

I'll continue playing with different fixed point representations and see what I'll get.

Thanks again for your hints (JJMack​,Test Screen Name), these were very helpful.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 19, 2017 Jun 19, 2017

Copy link to clipboard

Copied

1. You say you've tried integer and float. Did you try fixed point?

2. Don't use that web converter as a reference to compare to (though the value should be similar). Especially if you do not know the RGB working space used in the PSD, but even if you know It, different CMMs will produce different results, and rendering intent may also figure.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines