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

Format plug-in: Setting file properties/metadata

New Here ,
Sep 25, 2008 Sep 25, 2008

Copy link to clipboard

Copied

Hello,

I am currently writing a plug-in to import a proprietary image format into Photoshop. The people who will use this plug-in believe it would be useful to have some file information displayed in the File Info dialog.

The problem I'm running into is finding the functions necessary to set these properties in the File Info dialog, as currently they are all entirely blank.

As a simple example, if I wanted to have the Document Title, Author, Description and Keywords read "Hello, world!" after I've read in an image, what functions would my plug-in have to call to set each of these text fields?
Is there a struct that my plug-in needs to modify, or a group of get/set functions to change these properties?

Any information would be extremely helpful, as documentation on the subject is very difficult to find in the SDK.

Thanks a lot!

Jack
TOPICS
SDK

Views

719

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
Adobe
Participant ,
Sep 25, 2008 Sep 25, 2008

Copy link to clipboard

Copied

You're in luck: this is what my DITABIS File Format plugin does. You can inspect the GPL code @ http://www.telegraphics.com.au/svn/ditabis/trunk/

The important code:

> pb->propertyProcs->setPropertyProc(kPhotoshopSignature,propCaption,0, 0,h);

Contact me for more help if you need to.

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 ,
Sep 26, 2008 Sep 26, 2008

Copy link to clipboard

Copied

Thanks for your help, Toby.
I've got an idea of how to configure the properties at this point. Simple properties work now, but I am still running into a bit of trouble setting complex options such as the Caption tag. I create a handle, populate it with the null-terminated string for the caption, and then I use setPropertyProc to link that handle to propCaption. The code would go something like this:

>Handle h = sPSHandle->New( captionLength );
>if( h )
>{
> Boolean locked;
> Ptr p;
>
> sPSHandle->SetLock( h, true, &p, &locked );
> // In here, use memcpy to copy a typical C string into p
> sPSHandle->SetLock( h, false, &p, &locked );
>
>sPSProperty->setPropertyProc(kPhotoshopSignature,propCaption,0,0,h);
>}

Basically when I run my plugin and open a file, the Description field is still blank, as it was before I tried to populate the fields.

Is there something wrong with my approach? Incidentally, I also encounter the same problem when I use the same property and handle suite methods that you do (FormatRecord->PropertyProcs and FormatRecord->HandleProcs instead of sPSProperty and sPSHandle respectively). From looking at other available code online, I'm assuming that there isn't a difference in behaviour. Please correct me if I'm wrong! :)

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 ,
Sep 26, 2008 Sep 26, 2008

Copy link to clipboard

Copied

Sorry, the formatting ate a lot of my newlines and made my code fairly unreadable. Here is that code section, again:

> Handle h = sPSHandle->New( captionLength );
>
> if( h )
>
> {
>
> Boolean locked;
>
> Ptr p;
>
>
> sPSHandle->SetLock( h, true, &p, &locked );
>
>
> // In here, use memcpy to copy a typical C string into p
>
>
> sPSHandle->SetLock( h, false, &p, &locked );
>
>
> sPSProperty->setPropertyProc(kPhotoshopSignature,propCaption,0,0,h);
>
>}

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
Participant ,
Sep 26, 2008 Sep 26, 2008

Copy link to clipboard

Copied

It's quite a while since I wrote that code, but you can see from the source code I linked that propCaption is not a string - it's IPTC formatted data. Look at this file to see how I construct it:

http://www.telegraphics.com.au/svn/ditabis/trunk/metadata.c

Some links from google...

* http://www.controlledvocabulary.com/imagedatabases/iptc_naa.html
* http://libiptcdata.sourceforge.net/docs/iptc-overview.html

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 ,
Sep 30, 2008 Sep 30, 2008

Copy link to clipboard

Copied

Thanks so much, Toby! Your code really helped me out, and now all the properties I need display properly.

Cheers!

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
Participant ,
Sep 30, 2008 Sep 30, 2008

Copy link to clipboard

Copied

LATEST
Most welcome, Jack - glad I could help.

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