Skip navigation
Currently Being Moderated

CS6 png save options

Apr 11, 2012 12:37 PM

I've got a major script I use that performs .png saving every few seconds, but apparently there are some new compression options in CS6.  Is there a way for me to have the script use the "Smallest / Slow" compression option if CS6 is in use?  I currently use the script below for saving:

 

 function SavePNG(){
    permSaveFile = new File(permSaveFile);
    pngSaveOptions = new PNGSaveOptions();
    activeDocument.saveAs(permSaveFile, pngSaveOptions, true, Extension.LOWERCASE);
}

 

How would I add the extra CS6 save option in while still being able to use the script with older versions as well?  The rest of the script works fine and it saves fine under CS6; the only reason I need to change this is, the output files are HUGE using it, as is, under CS6.  Thanks for any help!

 

dgolberg

 
Replies
  • Currently Being Moderated
    Apr 11, 2012 12:54 PM   in reply to dgolberg

    Either put an if statement that checks the app version inside your function or test elsewhere and pass the value to your function… ( only got CS5 last year hum )

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 11, 2012 1:40 PM   in reply to dgolberg

    Are you sure this is CS6 as I do not see these options, could it be someone is using a plugin?

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 11, 2012 1:46 PM   in reply to Paul Riggott

    I see it in the the PSCS6 beta rev m.415 on Win7. No plugins in stalled. I don't have the scripting docs handy so I don't know if they added stuff in the DOM to support compression. He may have to end up using ActionManager code to get this to work.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 11, 2012 1:59 PM   in reply to dgolberg

    dgolberg is correct, this is a new option for cs6. I'm in the same boat, trying to find out how I can automate this option in.

     

    I tried a quick hack to achieve this by running "Save As" manually and save it as an action, then call the action from your script HOWEVER I found that it doesnt seem to apply any compression at all, regardless of the fact that the action says it's using compression. I'm thinking there's a bug in here somewhere.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 19, 2012 6:23 AM   in reply to dgolberg

    Hi dgolberg

    I had same problem and solved it.

     

    pngSaveOptions = new  PNGSaveOptions()

    pngSaveOptions.compression=9  // (level of compression 0 .. 9       0 - without compression)

    pngSaveOptions.interlaced=false


     
    |
    Mark as:
  • Currently Being Moderated
    Feb 18, 2013 12:31 PM   in reply to misoa

    I'm doing something wrong.

    I'm not getting any PNG compression in CS6 with this:

     

     

    }

    function SavePNG(saveFile){

    pngSaveOptions = new  PNGSaveOptions()

    pngSaveOptions.compression=9  // (level of compression 0 .. 9       0 - without compression)

    pngSaveOptions.interlaced=false

    activeDocument.saveAs(saveFile, pngSaveOptions, true, Extension.LOWERCASE);

     

     

    }

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 18, 2013 1:35 PM   in reply to Navarro Parker

    You could try this...

     

     

    var saveFile = File(Folder.desktop + "/test.png");
    savePNGCS6(saveFile);
     
    function savePNGCS6(saveFile) {
    var desc = new ActionDescriptor();
    var desc2 = new ActionDescriptor();
    desc2.putEnumerated( charIDToTypeID('PGIT'), charIDToTypeID('PGIT'), charIDToTypeID('PGIN') );
    desc2.putEnumerated( charIDToTypeID('PNGf'), charIDToTypeID('PNGf'), charIDToTypeID('PGAd') );
    desc2.putInteger( charIDToTypeID('Cmpr'), 9 );
    desc.putObject( charIDToTypeID('As  '), charIDToTypeID('PNGF'), desc2 );
    desc.putPath( charIDToTypeID('In  '), new File( saveFile ) );
    desc.putInteger( charIDToTypeID('DocI'), 308 );
    desc.putEnumerated( stringIDToTypeID('saveStage'), stringIDToTypeID('saveStageType'), stringIDToTypeID('saveSucceeded') );
    executeAction( charIDToTypeID('save'), desc, DialogModes.NO );
    };
    
     
    
     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points