Where to find list of save options?

Is there a list somewhere of the available save options per file type?

In this document, it shows how to save and shows an example of using the embedColorProfile save option.

Using { quality: 12 } works for jpg to save with quality level 12 (or any other value used). But that is the only save option I have figured out how to get to work. I am more or less just using trial and error in an attempt to figure out what to enter for the options.

So far, I’ve been able to get jpg, png and psd to save. However, tif doesn’t save at all. PNG will save with the last compression the user saved with. However, I want to force PNG to Large File Size (Quick compression). I would like to figure out how to make tif saving work too.

Anyway, just hoping maybe there was more reference material somewhere for saving images, or perhaps an example plugin show different save options.


I saw this topic and maybe I can help.

The documentation does not describe this SaveOptions very well indeed, but I think the options in the save method was “imported” from CEP extensions I think. So if you take a look in photoshop javascripting scripting guide you will see the following options for JPEG files:

For PNG and TIFF images there is some descriptions in there as well. I don’t know if it helps with your problem with tiff images, but this was what I found.

Hope it helps

Thanks. I am aware of the extendscript docs and did look through it and try some things out. However, I could never get tif to save. I figured I would just wait for more documentation on the subject because I am at a loss trying to figure it out with trial and error.

I saved .tif images using the batchPlay code generated by Listener. I set some options when saving and I think Listener caught those. It seemed to work, but I haven’t tested it extensively.

Can you reply with your function? I tried but couldn’t get it to work. Did you have to use the folderPicker to assign read/write access to the folder? Did you just feed the folder.nativePath from the folder picker folder into the batchPlay function?

await require(‘photoshop’).action.batchPlay([
//Save file as tif
{"_obj": “save”,“as”: {"_obj": “TIFF”,“byteOrder”: {"_enum": “platform”,"_value": “IBMPC”},“layerCompression”: {"_enum": “encoding”,"_value": “RLE”}},“in”: {"_path": filePath + “\\” + documentTitle + “.tif”}},
], {“synchronousExecution”: false, “modalBehavior”: “wait”})

The variable “filePath” was from the getFolder() function. I actually cut out a lot of code that Listener recorded and just kept it bare-bones.

Also, I’ve only tried this on Windows. I don’t know yet if it works on Mac. Would be curious if this works on Mac also if anyone tries it.

That is pretty much exactly what I already tried. I tried again with your exact function and still it won’t save on my PC. Is this how you are getting the filePath?

    var saveFolder = await require("uxp").storage.localFileSystem.getFolder();
    var filePath = saveFolder.nativePath;

var filePath = await require(“uxp”).storage.localFileSystem.getFolder()

var filePath = await require("uxp").storage.localFileSystem.getFolder();

This will assign a folder object containing the name, type and nativePath to filePath. So how are you passing the text string to your function? I tried just passing the entire object as you are indicating but that doesn’t work for me. It seems you should need to pass filePath.nativePath which is the text string of the file path. Anyway, nothing works for me and I am wondering if it is a folder permission thing because of the UXP restrictions which may be working differently on my computer or something along those lines. Although saving jpg, png and psd through the DOM works with the same folder… so I don’t really understand.

For testing, I also tried recording a function in Alchemist and using “as is” with the save file path directly embedded in the function and not using any function parameters. Then I used the getFolder() to bring up the folder picker before the save function runs to select the same folder. That didn’t work either. So it seems like it is either a bug or an issue with my specific system.

OK, I had to check. Looks like I used filePath.name for the filePath variable. Try that maybe instead of “.nativePath” though they look identical, so I’m not sure why .name works.

I also save this filePath.name variable to local storage and then retrieve it when I actually need to use it. Maybe that helps.

Thanks for your help. I tried .name too already. I also save it to a variable first.

However, I already hardcoded the path in the function to test in order to bypass the variable which didn’t work either. I’m pretty certain that what I have tried should work. My gut feeling is it is a folder permission issue related to the new UXP folder security. Not sure why the DOM works and not the batchPlay function though. Anyway, I think I will just put tif on ice for now and wait for more instruction in the docs for how to use tif with the DOM and then try again later.

I also had a problem initially too. I got a Photoshop program error. However, when I restarted PS, it worked. I’ve also only tested this on the pre-release version. Maybe the product version doesn’t support it.

The posting is a couple months old but maybe this is valid. I picked this up from a similar forum and use it in a function.

var doc = app.activeDocument;
var fName = doc.name;

function SaveTif(fName) {
var Path = doc.path;
var tifOpts = new TiffSaveOptions();
tifOpts.embedColorProfile = true; //or false
tifOpts.imageCompression = TIFFEncoding.TIFFLZW;
tifOpts.alphaChannels = false; //or false
tifOpts.byteOrder = ByteOrder.IBM;
tifOpts.layers = false; // or true
doc.saveAs((new File(Path + “/” + fName)), tifOpts, true, Extension.LOWERCASE);

@4Loren I’m afraid that’s for CEP JS. This code is not valid when working with UXP JS…