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

How to detect &/or delete notes in a photoshop document?

New Here ,
Jul 28, 2013 Jul 28, 2013

I'm using C# to batch process .psd files and extract jpeg's in various formats and sizes. However, the SaveAs hangs whenever a psd contains a note. I solved a similar hang condition due to alpha channels in the document by porting a script solution, but I can't see any way of deleting, enumerating, or even detecting notes in a photoshop document object.

Can anyone tell me how to do deal with notes?

I hope this is the correct forum for this question.

Thanks in advance.

TOPICS
Actions and scripting
1.2K
Translate
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
Mentor ,
Jul 28, 2013 Jul 28, 2013

I have never had any luck working with the open document using javascript. I can't find any useful Action Descriptor keys for this.

I can say that you can determine if the file has notes before you open it by searching the file for the string "8BIMAnno". And saving notes is one of the Photoshop save options. So you should be able to search the file for the notes tag and if found -  open, save without the notes, close, and open noteless version.

Translate
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
Mentor ,
Jul 28, 2013 Jul 28, 2013

Does C# not let you save as a copy? This Action Manger saves a document with notes as a jpeg( it strips out the notes durning the save )

var idsave = charIDToTypeID( "save" );

    var desc813 = new ActionDescriptor();

    var idAs = charIDToTypeID( "As  " );

        var desc814 = new ActionDescriptor();

        var idEQlt = charIDToTypeID( "EQlt" );

        desc814.putInteger( idEQlt, 12 );

        var idMttC = charIDToTypeID( "MttC" );

        var idMttC = charIDToTypeID( "MttC" );

        var idNone = charIDToTypeID( "None" );

        desc814.putEnumerated( idMttC, idMttC, idNone );

    var idJPEG = charIDToTypeID( "JPEG" );

    desc813.putObject( idAs, idJPEG, desc814 );

    var idIn = charIDToTypeID( "In  " );

    desc813.putPath( idIn, new File( "C:\\Users\\User\\Desktop\\spotChannels.jpg" ) );

    var idDocI = charIDToTypeID( "DocI" );

    desc813.putInteger( idDocI, 1210 );

    var idCpy = charIDToTypeID( "Cpy " );

    desc813.putBoolean( idCpy, true );// SaveAs copy

    var idsaveStage = stringIDToTypeID( "saveStage" );

    var idsaveStageType = stringIDToTypeID( "saveStageType" );

    var idsaveSucceeded = stringIDToTypeID( "saveSucceeded" );

    desc813.putEnumerated( idsaveStage, idsaveStageType, idsaveSucceeded );

executeAction( idsave, desc813, DialogModes.NO );

Translate
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
Guest
Jul 28, 2013 Jul 28, 2013

In case you still want to delete all notes in a photoshop document, the following code should do the trick (works for me in CS and CS4):

try

{

    executeAction (stringIDToTypeID ("deleteAllAnnot"));

}

catch (e)

{

}

HTH,

     -- Mikaeru

Translate
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
Mentor ,
Jul 28, 2013 Jul 28, 2013

Thanks, that works in CC as well. And it doesn't seem to need the try/catch block. At least in CC it will not throw an error if there are no notes.

Translate
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 ,
Jul 29, 2013 Jul 29, 2013
LATEST

That works great. Thanks all for the great responses!!

Translate
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