Skip to main content
Inspiring
April 11, 2012
Answered

CS6 png save options

  • April 11, 2012
  • 3 replies
  • 10720 views

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

This topic has been closed for replies.
Correct answer misoa

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


3 replies

misoaCorrect answer
Participant
April 19, 2012

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


dgolbergAuthor
Inspiring
April 19, 2012

That did it!  Thanks a ton misoa!

Edit: And it also still works in CS4 without having to setup a version check to run it differently!

Participant
April 11, 2012

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.

Inspiring
April 11, 2012

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 )

dgolbergAuthor
Inspiring
April 11, 2012

That's kind of what I figured, but what do I have to change to get it to save using the "Smallest / Slow" compression if CS6 is detected?  I'm not sure what changes need to be made to get it to change the compression type, as I don't currently have CS6 to test it with (and  I probably wouldn't know what to change anyway, unless it's simply a second boolean in the "saveAs" line).  There are people running this script, though, that are using CS6, so I need to make sure it's programmed in.

Paul Riggott
Inspiring
April 11, 2012

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