0 Replies Latest reply on Nov 18, 2015 10:01 PM by K159

    How to maintain the quality of the reduced image?

    K159 Level 1

        

                              InDesign CC                                                           InDesign 5.5

       

       

      Hi.

       

      Both are the same source and image.

       

      I want to improve the image quality of  the InDesign CC ScriptUI.

       

      Any ideas?

       

      Thanks.

       

       

       

       

      Save image

        set_png_export_options();
          var myFileName = "preview.png";
          var myFilePath = "C:/Users/user1/Desktop/" + myFileName;
          var myFile = new File(myFilePath);
          app.activeDocument.exportFile(ExportFormat.PNG_FORMAT, myFile);
      
      function set_png_export_options() {
          with(app.pngExportPreferences) {
              antiAlias = true;
              embedColorProfile = true;
              exportResolution =  72;
              exportingSpread = false;
              PNGColorSpace = PNGColorSpaceEnum.RGB;
              PNGExportRange = PNGExportRangeEnum.EXPORT_ALL;
              PNGQuality = PNGQualityEnum.HIGH;
              simulateOverprint = true;
              transparentBackground = true;
              useDocumentBleeds = true;
          }
      }
      
      
      
      
      
      

       

       

       

       

      Load image

      main();
      function main()
      {
          Image.prototype.onDraw = function()
          {
          if( !this.image ) return;
          var WH = this.size,
          wh = this.image.size,
          k = Math.min(WH[0]/wh[0], WH[1]/wh[1]),
          xy;
          wh = [k*wh[0],k*wh[1]];
          xy = [ (WH[0]-wh[0])/2, (WH[1]-wh[1])/2 ];
          this.graphics.drawImage(this.image,xy[0],xy[1],wh[0],wh[1]);
          WH = wh = xy = null;
          }
      
      
          var w = new Window ("dialog", "test");
       
          var photo = w.add ("image", undefined, File ("C:/Users/user1/Desktop/preview.png"));
          photo.size = [200,300];
       w.show ();
      }