Saving to RGBA file extention

Discussion of Photoshop Scripting, Photoshop Actions and Photoshop Automation in General

Moderators: Tom, Kukurykus

shell_fishman
Posts: 2
Joined: Sun Oct 06, 2019 3:33 am

Saving to RGBA file extention

Post by shell_fishman »

Hi, Im trying to create a photoshop (jv) script that would save a .rgba (SGI RGB) extension when I save my photoshop file. I manage to modify a script to save out a SGI file. It just won't change the file extension to .rgba

Please Help.



main();
function main(){
var Name = app.activeDocument.name.replace(/\.[^\.]+$/, '');
var Ext = decodeURI(app.activeDocument.name).replace(/^.*\./,'');
if(Ext.toLowerCase() != 'psd') return;
var Path = app.activeDocument.path;
var saveFile = File(Path + "/" + Name +".rgba");
if(saveFile.exists) saveFile.remove();
SaveSGIRGB(saveFile);
}
function SaveSGIRGB(saveFile){
rgbaSaveOptions = new SGIRGBSaveOptions();
activeDocument.saveAs(saveFile, rgbaSaveOptions, true, Extension.LOWERCASE);
}
User avatar
Kukurykus
Posts: 528
Joined: Mon Jul 25, 2016 12:36 pm

Re: Saving to RGBA file extention

Post by Kukurykus »

Javascript Scripting Reference notes: The SGIRGB format is not installed automatically with Adobe Photoshop CC
shell_fishman
Posts: 2
Joined: Sun Oct 06, 2019 3:33 am

Re: Saving to RGBA file extention

Post by shell_fishman »

I know. I had already installed the SGI RGB plugin. I am able to save it into a SGI/rgba file format manually, but I want it to be abler to auto-save it as a rgba file and not a sgi file.

The script I had posted allows me to do that but I am unable to make the script change the saved file extension into a rgba. It only save as a sgi file extension.
User avatar
Kukurykus
Posts: 528
Joined: Mon Jul 25, 2016 12:36 pm

Re: Saving to RGBA file extention

Post by Kukurykus »

Maybe after your code (if wrote and modified correctly to save with .sgi extension) add this part:

Code: Select all

File(fN = activeDocument.fullName).rename(decodeURI(fN).replace(/\sgi$/, 'rgba'))