Skip to main content
Participating Frequently
November 29, 2012
Question

One-click 'Save as jpeg' shortcut script please! - saved in the same folder

  • November 29, 2012
  • 4 replies
  • 59004 views

Hi, I've been re-directed here because I was told a script could solve my problems - but I have no scripting experience/knowledge/ability! Below is my original problem and post. I got as close as 2 button presses, but I'm after that sweet, sweet single-button, double-my-productivity shortcut! Thanks!

http://forums.adobe.com/thread/1106992

I use 'Save as .jpeg' ALL the time (Photoshop CS6, Mac ML), and it really feels like I should just be able to press one button (a shortcut) and the name/quality dialogs don't appear and it just saves a .jpeg into the folder that my original .PSD/file is in.

So basically:

- Press one button to save my open .PSD/file as a .jpeg

- Automatically save it in the same folder as my .PSD

- Save it as '10' quality in the jpeg settings

- No dialog boxes, as soon as I press the button, it saves it - if there's already a .jpeg of the same name, it creates a '-1','-2' etc.

I've tried using 'Actions', but it seems to save it wherever my original Action folder was - it doesn't change to whatever the current folder the .PSD is in...

Thanks!

Adam

This topic has been closed for replies.

4 replies

New Participant
September 28, 2021

Hi all - got a few javascripts that I hacked together that work great on Windows10. Have a look, download, alter as needed. 

 

https://github.com/mdmowry/photoshopSaveActions

 

best - 

Michael 

Participating Frequently
July 22, 2017

Bonjour

 

I do not know if RemoveCopy.zxp works with CC ???

See Remove copy from layer name

May 31, 2016

Try this!!!

Edit > Preference > Export...

then

It would show this option: "Quick Export Format"

then choose particular format you want to be save, let's say "JPG" then choose the quality like "90%"

and then hit 'Okay'

Now you have a shortcuts to save as jpg all the time by pressing...

File > Export > Quick Export as 'JPG'

*this can be called shortcuts right??? I guess?

but it's faster and easy than choosing format every time when you save. or making those ugly and seems difficult script.

Hope it helps!

New Participant
July 8, 2016

Hi Adam,

The next code work as described under PS CS6 Win 10

It duplicates the flattend file instead of saveAs. When layers are active Saveas to JPG will not work.

create an action with a keyboard shortcut onto this script.

--- copy below and paste in a jsx file --

var  sAlertDocumentNotOpen = "No open document !";

var jpgQuality = 10;

main();

function main() {          

        if ( app.documents.length <= 0 ) {

                alert( sAlertDocumentNotOpen  );

                return 'cancel'; // quit, returning 'cancel' (dont localize)

        }

        var fileName = app.activeDocument.fullName.toString().slice( 0, -4 );  // copy the name of the document  without the extension ( .psd assumed )

        var jpgDoc = app.activeDocument.duplicate( "JPGFILE", true );       // duplicate with merged layers

   

        fileName = getNewFileName( fileName );        

        saveFile( jpgDoc, fileName );

     

        return true;

}

  

function saveFile( docRef, fileName ) {

 

            docRef.bitsPerChannel = BitsPerChannelType.EIGHT;           

            var saveFile = new File( fileName );

            jpgSaveOptions = new JPEGSaveOptions();

            jpgSaveOptions.embedColorProfile = true;

            jpgSaveOptions.quality = jpgQuality;

            docRef.saveAs(saveFile, jpgSaveOptions, true, Extension.LOWERCASE);

            docRef.close( SaveOptions.DONOTSAVECHANGES );  

           

            return true;

}           

function pad(num, size) {

    var s = "000" + num;

    return s.substr(s.length-size);

}

function getNewFileName( fileName ) {

    var num = 1;

    fileName = fileName + "-";

   

    while  ( File(   fileName  +  pad(num,4) + ".jpg" ).exists )  {

        num = num +1;       

    }

    return fileName  + pad(num,4) + ".jpg";

}

// best regards: Willem

JJMack
Community Expert
Community Expert
July 8, 2016

If you do not want to overwrite saved JPEG files with a file open you can record a single step action that uses the Image Processor Pro plug-in  Menu File>Automate>Image Processor Pro....   Fill the dialog  like this.  The Plug-in will record those setting into the action's step.  Assign a Shortcut to the action.  When you use the shortcut the action will save a jpeg with a unique filename it will add a serial number to the  current document name and save that unique jpeg there will be no dialog display the next jpeg image for the document will be saved  into the current document folder you can continue editing your open layer document.

exactly what the OP asked for it is easy with Image processor pro thanks to X

JJMack
Tom Ruark
Inspiring
November 29, 2012

File -> Scripts -> Script Events Manager

Click Enable Events at the top

Select Save Document from Photoshop Event  drop down

Select Save Extra JPEG from Script drop down

Click Add

Click Done

EVERY document you save, except JPEG files, will save a jpg file. Saving will be slower.

You will need to modify line 62 of the Save Extra JPEG.jsx file located here: <YOUR_PHOTOSHOP_INSTALL_LOCATION>\Presets\Scripts\Event Scripts Only

In order to boost your quality to '10'. Here is the line in question

jpegOptions.quality = 2; // really low

Change it to

jpegOptions.quality = 10; // really high

You will need to modify the script to get this problem solved as well: it saves it - if there's already a .jpeg of the same name, it creates a '-1','-2' etc.

You can steal code out of Image Processor that finds a file name that is unique for the folder so you don't get overwrites.

Are you sure you want that? If you do lots of saves you are going to fill up your disk fast.

adam!!Author
Participating Frequently
November 29, 2012

Thanks, it works but is there a way to make it selective? Like you said, if it saves EVERYTHING with a .jpeg my disk isn't going to last!

I tried adding an Action that turns on the 'script events manager', saves the file, then turns if off, so I could map it to a button and that would run. Problem is, the Action only brings up the 'script event manager', it doesn't tick the box and press 'Done' like when I recorded it...

Any ideas?

Thanks,


Adam

Stephen Marsh
Community Expert
Community Expert
July 22, 2017

Stephen, thank you for your response. I'll give it a try.


Not a problem, the Image Processor Pro script mentioned by JJMack can be found here:

 

Image Processor Pro

 

 

P.S. I fixed up the 3rd regex rename slightly too, just in case this helps somebody out in the future:

 

(^.*)\scopy(\..*$)