Copy link to clipboard
Copied
Is it theoretically possible for a filter to pass the image from Photoshop to a C # program, the program makes some changes and passes the new image back to the filter and the filter passes it back to Photoshop?
Copy link to clipboard
Copied
Depends on what you mean by "a C# program".
If you mean you're writing both the plugin filter and the external program, the answer is certainly "yes". In keeping with it's tendency to provide multiple redundant ways to accomplish any task, PS supports OLE automation in addition to its plugin API. (The Topaz plugin suite uses this method: stub plugins that invoke an external .exe file to do the heavy lifting.)
If you mean you're writing a plugin and you want it to pass the image to a third-party standalone image processing program, the answer is "possibly". If the external program supports OLE, it's possible your plugin can hook onto both ends and provide the communications channel, sort of like a translator with a phone in each ear.
Hey, you did say "theoretically"...
Copy link to clipboard
Copied
Yes, I will program both, the filter and the C# application.
The reason why I want to do this is because I have already a working C # Programm.
Copy link to clipboard
Copied
I don't think there is any reason why it wouldn't be possible: when initializing the filter exec your program that would be then waiting for the input, then start retrieving the pixel data chunk by chunk, pass it to the external app using, say, shared memory ( e.g on Windows.see c# - sharing memory between two applications - Stack Overflow, but you may want also look at more cross-platform way of data sharing), get the C# program do its work and then store the data back from your filter. Somewhat hectic but doesn't seem to be impossible.
Yet another possibility is for your c++ code to be a host of your c# one (see Hosting Overview).
None of these actually requires much from PS except for the data itself - it's pretty much a generic "exchange data between c++ and c#" kind of design.
Copy link to clipboard
Copied
Is there no COM interface that I can use in C#. I can not find it in the current SDK package.
A solution could be to open the C# application from the filter and over the COM interface load the selected image from photoshop to the c# application, manipulate it and create new image in photoshop.
But as I said, I can not find the COM interface for Photoshop CC.
Also I do not see the part in the documentation of the plugin sdk that describe how to read pixel data. Is there a additional documentation for the interface?
Copy link to clipboard
Copied
I don't believe there is one, but as I've said above, invoking C# code from within the non-managed (basically C) framework that is provided by the plugin is a common problem with a common solution. Also, you may want to also consider the fact that PS is a cross-platform product and by using C# you are basically choosing to ignore your potential Mac users.
The pixel data is read and written using a filter type of a plugin. The examples in the SDK are also under the filter category.