Skip to main content
April 16, 2014
Question

FileFormat Plugin Access/Store selections

  • April 16, 2014
  • 1 reply
  • 957 views

Hi everybody,

I'm developing a file format plugin which reads/writes layered image data.

The file format also contains selections.

My question: How can I store these selections in the document so the user could load them via Selections->Load Selection?

I wonder if this can be done by using the Resource Suite or Channel Ports.

Any help would be greatly appreciated.

This topic has been closed for replies.

1 reply

May 5, 2014

Ok, after some searching and trying I found out that these selections are stored as alpha channels.

Writing of theses selections is no problem as you can retrieve it from the documentInfo structure via the alphaChannels linked list.

The data can then be retrieved with the ChannelPortsProcs in the format record.

Reading is another story.

The documentation states that you can set formatrecord->planes to a  higher value to include transparency and additional channels.

But this should be not higher than 16.

So in theory I should take my composite channels + transparency channel + selection/alpha channels and write them together into the data buffer of the formatrecord.

Another way seems to be the ChannelPortsSuite where I can create a port with the New function and write data to it.

But in both ways I can't set the name of the alphaChannels on read.

I have to check if I get a valid documentInfo structure in the formatSelectorReadFinish.

Maybe it is possible to set the names of the selections afterwards.

Christian

May 16, 2014

Update

ChannelPortProcs is not working for writing data to additional. I think the port is the problem.

It is possible to create a new write port and store the data in it, but I was not able to determine where this port points to or what is the level in the pyramid of the image,

which is mentioned in WritePixelToBaseLevel documentation.

After some trying I think this not the way to go.

The other way was to set the planes field in the FormatRecord to (color planes + transparency + additional alpha channels)

Just specifying this gaves me a new Alpha Channel in the opened document but the transparency read in plane=3 was gone.

Setting the data to full transparency overlapped all layers and the document was full transparent.

I think because the channel will be displayed automatically.

I can't check it at the moment maybe the layer transparency is not lost at all.

So at the moment the only way I see is to do it in this way and write an automation plugin,

which hides the additional alpha channels and rename them.

Maybe it is possible to write the selection names to the script parameters and read them in the automation plugin.

May 21, 2014

Ok, maybe some of the Adobe Devs can help me here.

I figured out from the PSD file format specification that Photoshop uses the last plane for layer transparency.

The channels in between are the alpha channels.

That seems to fit.

But when i read data into these planes they do not appear in the document.

All I can see are empty alpha channels.

Reading the alpha channel names seems to be done with image resource data.