Tuesday, December 6, 2011

How to get the pixel data so as to work...

Hi all,



I am trying to write a plug-in that will crop and scale the image, edit the selection in the image document based on image data. For this purpose I need the pixel data of the image. How to get the image data as different pixels and what is the data structure used to store this data?



Assumption: No layers i.e., only background



Thanks in advance,

Sailu
How to get the pixel data so as to work...
If you want to edit the image inside a selection, a Filter plugin can do that. See the SDK docs.



As for cropping and scaling, a Filter can't. Look into scripting or Automation? (I don't know anything about Automation plugins.)
How to get the pixel data so as to work...
Thanks Toby for the reply.



I have a doubt about the filter plug in. Is it possible to get the whole image into the plug in even if there is a selection on the image?

If it is, how?



Thanking you once more,

sailu.

GetFilterRect() will return a Rect for the whole image (everything).



If you SetInRect() to that (assuming that gFilterRecord-%26gt;input is the default / 1%26lt;%26lt;16), then that will give you the whole image (everything). The selection comes in as an additional plane.



Take a look at the example code for ''Dissolve''. There is a function (csplanesfrommode or something like that) that will tell you how many planes are for image data and not masks or selection. set inLowPlane, etc. etc. to tell Photoshop which planes you want. If you ask for more than one plane at a time, the data will come in interleaved. e.g. RGBRGBRGB instead of RRRGGGBBB

If you are writing a commercial plugin, use the channel port suites and

work on the images in a tiled fashion to make efficient use of memory.



If this is a personal project, and you just want the pixel data in a format

that you can do calculations on, save the image in Photoshop raw format

(unrelated to camera raw) and read the array of pixel values directly from

that file. This is an easy way, for example, to get the image data into

matlab.

Hi all,



I have a similar problem: I am writing an automation (no filterRecordInfo in sight) plugin and I am trying to display a preview of the whole current image in my plugin's dialog. How to access image data?

I am trying to build a proxyview similar to the one in PoormanType example, but without filtering. Just a preview of the document.



Thank you in advance!!



Chaker

The classic solution is to have two plugins, an automation and a filter, that communicate with each other; e.g. you run your automation, spawn the filter, get the image data, deal with it and then pass the result back to the automation. The other option is to show all your dialogs from the filter and then spawn your automation that will do the work. It all depends on how the actual work is split between the automation plugin (application and document level manipulations) and the filter (actual pixel data updates).

Hi Ilya,

Thank you for your post. In the plugin architecture you propose (automation + filter), do you have an idea about how to share the pixel data between the two plugins? I have found a post that gives details about how to get pixel data and show it using ADM components
Matthew Hollingworth, ''ADM Color Managed Preview?'' #1, 22 Oct 2007 11:53 pm but it supposes that you have a filter plug-in.



Again, does anyone knows how to preview the current image in a AUTOMATION plug in? This seems impossible.



Thank you all for your help



Cheers,

Chaker

It seems that Ilya is right. To have a preview proxy in an automation plugin, the only obvious way is to have a filter plugin aside. Hidden filter seems to be a good condidate. This post gives some details: http://www.adobeforums.com/webx/.59b4c7cc/0
  • help blackheads
  • No comments:

    Post a Comment