5 Replies Latest reply on Apr 21, 2011 1:55 PM by jay_2014

    'Save As' to JPEG format (or to TIFF)

    Geoff.G

      The 'Save As' command produces 20 different file format options to choose from. When 'saving as' to the default PSD format, the selection is obviously quick and easy. However I mostly 'save as' to JPEG format or TIFF format and it is awkward to make the JPEG or TIFF format selections each time.

       

      After doing 'Save As', I have been clicking on 'Format' and then typing 'j' or 'ti' to bring up JPEG or TIFF from the menu of 20 formats to speed up the selection a little bit as compared to scrolling through the Format menu.

       

      But it would be much easier to have a script that could bring up a modified version of the "Save As" dialogue box so that 'Save As' to JPEG format or 'Save As' to TIFF format could be executed very efficiently and without having to wade through the clutter of the 17 other file formats in the Format menu which I hardly ever use.

       

      I have done a fair amount of web searching, including on ps-scripts.com, but so far without finding a good solution to this. Any help would be much appreciated.

       

      Of course I have thought of creating an Action (with assigned keyboard shortcut) which saves to JPEG and another Action which saves to TIFF. However, the saved file then always ends up in one location and with the same file name, therefore often requiring the additional steps of renaming and moving the file.

       

      Batch processing of Actions (perhaps in conjunction with the Image Processor script) is perfect for batches, especially for large batches but I was hoping for something quick and easy for saving files individually.

       

      Thanks!

       

      Geoff

       

      P.S. I also tried finding a way of disabling all the 'Save As' file formats which I never use so that the 'Save As' format choices would be very few (i.e. 3 or 4 instead of 20) but have had no success there.

        • 1. Re: 'Save As' to JPEG format (or to TIFF)
          jay_2014 Level 1

          This is not a PhotoShop Function.

          In the Core JavaScript Classes use the File class.

          File.saveDlg( prompt, filter)

          The filer parameter is the one you want.

          • 2. Re: 'Save As' to JPEG format (or to TIFF)
            Geoff.G Level 1

            Thank you for your reply.

             

            Sorry for my ignorance, but I am a scripting novice and you lost me. Would you mind explaining it in a less technical way perhaps?

             

            Geoff

            • 3. Re: 'Save As' to JPEG format (or to TIFF)
              jay_2014 Level 1

              Assuming you know how to save a script and assuming you know how to run it and assuming you only have one document open.

               

              The filter parameter is a semicolon ";" delimited string with more then one value wrapped in quotes of course

              "*.jpg;*.psd;*.mp3"

               

               

              Put the code below in your script and call it from photo shop

              var file = new File( );
              file.saveDlg("hello world", "*.jpg" );

              1 person found this helpful
              • 4. Re: 'Save As' to JPEG format (or to TIFF)
                Geoff.G Level 1

                Thanks very much! I think I am almost there but not quite...

                 

                I browsed some other posts relating to "file.saveDlg" and learned that since I am on Mac (10.6 - I hadn't mentioned it before) I need to insert the extension in the first line of the script, i.e.:

                 

                var file = new File("x.jpg");

                file.saveDlg("hello world", "*.jpg" );

                When I run the above script, I get a "Save As" dialogue box for the file "x.jpg" but then when I click on the "Save" button, the file is not saved in the location I selected nor anywhere else that I can find.

                 

                I will do some further reading tomorrow and see what I can do to make it work since most likely I am doing something not quite right. Obviously you have pointed me in the right direction. Much appreciated.

                 

                Geoff

                • 5. Re: 'Save As' to JPEG format (or to TIFF)
                  jay_2014 Level 1

                  It's been awhile since I played with the saveAs function.

                  Pretty sure you have to type the file name in the save dialog

                   

                  Here is a function I created for work.

                  I removed a lot of code from it that doesn’t pertain to this topic but the code should work

                  This might help you with a little more understanding and show how you can hard code where to save without even bringing up a dialog box

                   

                  saveAsPNG( filelocation + filename )// usage

                   

                  function saveAsPNG( where ){

                                 var tmpFile = File(where + '.png' );

                                 var pngOpts = new ExportOptionsSaveForWeb;

                                      pngOpts.format = SaveDocumentType.PNG

                                 //     pngOpts.PNG8 = true;

                                      pngOpts.transparency = true;

                                 //     pngOpts.interlaced = false;

                                      pngOpts.quality = 100;

                                 app.activeDocument.exportDocument(tmpFile,ExportType.SAVEFORWEB,pngOpts);

                            return true;

                  }