[SDK development] How to attach arbitrary information to a document opened in Photoshop

Discussion in 'Photoshop Tutorials' started by François Robert, Apr 11, 2006.

  1. Dear NG

    I am writing a set of plugins for Photoshop CS2 (which I will call PS9
    for consiseness).
    Two of those plugins are transferring PSD files from/to a remote server
    and are therefore automation plugins. The 'download' plugin gets the PSD
    from the server to a local file and then directs PS9 to open it (hence
    the need for an automation plugin). After having done so, I would like
    to attach a unique ID to the newly opened document, so that the
    'upload' plugin (that does the symetric operations) could distinguish
    between documents that were obtained via download and other documents
    that were created / loaded locally and do things differently.

    I have read the PS9 SDK and it seems to me that the Pseudo-resources
    suite would provide what I need. The "Photoshop API Guide.pdf" go as far
    as stating, p61 :
    <quote>
    This suite of callback routines provides support for storing and
    retrieving data from a document. These routines provide pseudo–resources
    which plug–in modules can attach to documents and use to communicate
    with each other.
    </quote>

    I looked in the PS9 SDK C headers and apparently "Pseudo-resources" is
    how this particular bit of documentation calls what I already knew as
    "Image Resource Block" (IRB, from the Photoshop file format
    specifications).

    A couple of discussion on Usenet and elsewhere also seemed to confirm
    this :
    http://groups.google.com/group/comp.graphics.apps.photoshop/
    browse_thread/thread/ae16cadc3df1a411
    and also this discussion :
    http://graphicsgalaxy.com/forums/thepluginsite/viewtopic.php?
    t=488&sid=3d96877e0466070608ebe5fbe41b0ebd

    My questions are :
    a) If Pseudo-resources are indeed IRB, then they are persisted in the
    PSD files (and the JPG / TIFF too) when the user saves the document they
    are attached to. Correct ?

    b) Can I create IRB / pseudo resource with arbitrary IDs ? (that is,
    Photoshop has a documented set of IRB IDs. How do I add my own ?)

    c) How do I access those IRB / pseudo resource from an automation plugin
    ? The Pseudo resource suite API is available to non-automation plugin
    only, it seems, so does that mean that I have to write an specific non-
    automation plugin just to access pseudo-resources ? If that's the case,
    then what type of non-automation plugin should that be ? Filter ? Export
    ? Import ? Format ?

    d) Alternatively, Is there a way of getting / setting this extra info in
    a more direct way, from the automation plugins themselves ? For
    instance, the SDK Getter plugin can read quite a bit of information for
    a given document. Is there a way to attach / detach info to the document
    using the same API as the Getter does ?

    e) Alternatively again, I envisionned to somehow share between 'upload'
    and 'download' plugins the list of opened documents and their associated
    unique ID. The SDK states that each plugin can persist in PS9 some
    private globals, but the only way to "share" data appears to have the
    'donwload' plugin invoke (how ? is my question) the 'upload' plugin and
    pass it the data.


    Any help appreciated.
    _______________________________________________________
    François Robert
    (to mail me, reverse character order in reply address)
     
    François Robert, Apr 11, 2006
    #1
    1. Advertisements

  2. François Robert

    toby Guest

    I imagine you would try to register your own type with Adobe.
    Have you considered using File Info metadata such as keywords?

    --Toby
     
    toby, Apr 11, 2006
    #2
    1. Advertisements

  3. The question was actually whether PS9 actually checks the IDs or if any
    arbitrary ID other than '8BIM' will do (from PS9 standpoint)?
    Registering with Adobe is under consideration at this point, though.
    ....
    Yes. But AFAIK the user has access to this info from PS9 (and thus the
    info is liable to be changed by user...).
    Besides, the info to attach is something that is needed only while the
    document is loaded in Photoshop. In fact, attaching the info to the
    *window* of the document would be fine, only that I have not find a
    portable way of doing that (Mac / Window and from version to version of
    PS).

    _______________________________________________________
    François Robert
    (to mail me, reverse character order in reply address)
     
    François Robert, Apr 12, 2006
    #3
  4. François Robert

    Mike Russell Guest

    Have you considered using web folders, VPN mounted remote file systems, or
    some other way to access files remotely? This would change the job from
    programming to system administration, and get it done in a matter of days
    instead of weeks.

    Toby's answers need no correction - but I would add the caution that there
    are two types of resources stored in an image by Photoshop. The pseudo
    resources created by a filter plugin are different from the resources
    Photoshop itself uses, for example, to store eyedropper sample points. The
    IRB may be Photoshop's own resources, not those of the plugin.

    It also seems to me that you will need to remove your pseudo resource tags
    at the remote end, to avoid double tagging when the image is re-opened, and
    so that opening the image directly will not be mistaken for a remote open.
     
    Mike Russell, Apr 12, 2006
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.