Cannot specify file type:app.activeDocument.save

hello,

When I run the saved code, the saved file type is always PSD and cannot be changed. Is there any good way to solve it? I want to save as the specified type.

await require("photoshop").core.executeAsModal(async function (c) {

    const file = await require("uxp").storage.localFileSystem.getFileForSaving("a.png", {
        types: ["png"]
    });

    await require("photoshop").app.activeDocument.save(file, {
        embedColorProfile: true
    });
    
}, {
    "commandName": "test"
});

manifest v5:

  "requiredPermissions": {
    "localFileSystem": "request",
    "launchProcess": {
      "extensions": [".jpg", ".png", ".psd"]
    }

ps version 23.4.1,win10 x64

May I ask where did you find this code example? In the docs I find getFileForSaving() accepts only one argument (you provide two) and save() does not accept any at all (you provide also two)

Hi,

The code I found here:

save:https://developer.adobe.com/photoshop/uxp/ps_reference/classes/document/#save

I think that’s for Ps v22. Here’s for v23
Sorry, I personally didn’t have to deal with document save myself, just noticed, that methods are used differently from what docs say

if I want to save as PNG or JPG, what should I do?

I’d try doing it with BatchPlay

@Karmalakas Thank you for your help.

I have found the code:

await app. activeDocument. saveAs. jpg(entry_jpg,{ quality: 12 }, true)

https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/document/#saveas

I was looking there in Methods section and didn’t even notice it’s a property :man_facepalming: Only at Adobe someone might think of such object structure :sweat_smile: