2 Replies Latest reply on Aug 29, 2012 8:13 AM by csm_phil

    How to control resolution of exported jpeg

    Matthew Wolf

      I know I can control the resolution of an exported jpeg through the UI with the Export JPEG dialog box. I'm wondering how to access that setting with the object model. When I export to a jpeg with my script, it seems to use whatever resolution setting was last selected through the UI. I would like my script to explicitly say what resolution to use.

       

      Thanks!

        • 1. Re: How to control resolution of exported jpeg
          Muppet Mark Level 5

          Change the app preference JPEGExportPreference before the export…

          • 2. Re: How to control resolution of exported jpeg
            csm_phil Level 4

            Hi Mathew,

             

            Please check the below JS code. I am not use the UI just Prompt to get the input value of resolution.

             

             

            var myPrompt = prompt ("Enter the Value Resolution Value", '300')
            var myFold = Folder("~/Desktop");
            var myFile = new File(myFold +"/"+"csmphil.jpg");
            SaveAsJPEG(myFile);
            
             function SaveAsJPEG(myFile){
                try{
                    app.jpegExportPreferences.exportResolution = parseInt(myPrompt);
                    app.jpegExportPreferences.jpegQuality = JPEGOptionsQuality.MAXIMUM;
                    app.jpegExportPreferences.jpegRenderingStyle = JPEGOptionsFormat.BASELINE_ENCODING;
                    app.selection[0].exportFile(ExportFormat.JPG, myFile);
                    }catch(e){};
                }
            
            

             

             

            thx,

            csm_phil

            1 person found this helpful