Skip to main content
Inspiring
January 8, 2018
解決済み

EPS to JPG Export Options in 300 dpi - Illustrator

  • January 8, 2018
  • 返信数 1.
  • 5045 ビュー

Hi All,

I am trying to export eps to jpg in Illustrator. The jpg resolution was 72 dpi. But We need 300 dpi. Please see my below save options code and. Please help me to change the resolution.

Code:

Thanks,

Magesh

このトピックへの返信は締め切られました。
解決に役立った回答 Mageshwaran

hmm.

When i run it i get a jpeg.

if you change the extension in line 2 to .png then you certainly get a png.

However I just tryed to open the jpg i made in photoshop and got an error that " an unknown or invalid jpeg marker was found".

Does anybody know what could be causing this?


Hi Dane,

I am using below action code and received the correct output.

////////////////////////////

var dest = Folder.selectDialog("Pick a folder and save the JPEG there."); 

                 if(myFolder == null){exit(0);}

                

                

function test(){ 

     

     

      String.prototype.hexEncode = function(){ 

      //http://stackoverflow.com/questions/21647928/javascript-unicode-string-to-hex 

        var hex = ''; 

        for(var i=0;i<this.length;i++) { 

            hex += ''+this.charCodeAt(i).toString(16); 

        } 

        return hex; 

      }; 

     

     

      function writeFile(fileDestStr, contents){ 

      var newFile = File(fileDestStr); 

      newFile.open('w'); 

      newFile.write(contents); 

      newFile.close(); 

      }; 

     

     

      var actionStr = [ 

     "/version 3",

"/name [ 4",

"54657374",

"]",

"/isOpen 1",

"/actionCount 1",

"/action-1 {",

"/name [ 12",

"53617665204d79204a504547",

"]",

"/keyIndex 0",

"/colorIndex 0",

"/isOpen 1",

"/eventCount 1",

"/event-1 {",

"/useRulersIn1stQuadrant 0",

"/internalName (adobe_exportDocument)",

"/localizedName [ 9",

"4578706f7274204173",

"]",

"/isOpen 1",

"/isOn 1",

"/hasDialog 1",

"/showDialog 0",

"/parameterCount 7",

"/parameter-1 {",

"/key 1885434477",

"/showInPalette 0",

"/type (raw)",

"/value < 104",

"0a00000001000000030000000200000000002c0101000000000000000100000069006d006100670065006d00610070000000310000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",

">",

"/size 104",

"}",

"/parameter-2 {",

"/key 1851878757",

"/showInPalette -1",

"/type (ustring)",

"/value [ PUT_FOLDERPATH_CHAR_LENGTH_HERE",

"PUT_HEX_FOLDERPATH_HERE",

"]",

"}",

"/parameter-3 {",

"/key 1718775156",

"/showInPalette -1",

"/type (ustring)",

"/value [ 16",

"4a5045472066696c6520666f726d6174",

"]",

"}",

"/parameter-4 {",

"/key 1702392942",

"/showInPalette -1",

"/type (ustring)",

"/value [ 12",

"6a70672c6a70652c6a706567",

"]",

"}",

"/parameter-5 {",

"/key 1936548194",

"/showInPalette -1",

"/type (boolean)",

"/value 0",

"}",

"/parameter-6 {",

"/key 1935764588",

"/showInPalette -1",

"/type (boolean)",

"/value 1",

"}",

"/parameter-7 {",

"/key 1936875886",

"/showInPalette -1",

"/type (ustring)",

"/value [ 1",

"31",

"]",

"}",

"}",

"}"

      ].join("\n"); 

     

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

      return; 

      } 

     

      var destStr = decodeURI(dest.fsName); 

     

      var actionFileDestStr = Folder.desktop + "/MyAction.aia"; 

      writeFile(actionFileDestStr, actionStr.replace("PUT_FOLDERPATH_CHAR_LENGTH_HERE", destStr.length).replace("PUT_HEX_FOLDERPATH_HERE", destStr.hexEncode())); 

      var actionFile = File(actionFileDestStr); 

      app.loadAction(actionFile); 

      app.doScript("Save My JPEG", "Test"); 

     

      //clean up 

      actionFile.remove(); 

      app.unloadAction("Test", '');

     

    }; 

    test(); 

////////////////////////////

返信数 1

daneJ
Inspiring
January 8, 2018

Hi Magesh

with exportOption.verticalScaling and horizontalScaling it is somehow possible to get a 300ppi jpeg I think?

However i use app.imageCapture rather than app.exportFile. In this command you can give .resolution = 300.

The captureClip Variable below exports then only then active artboard.

var aiApp = app.activeDocument;

var dest = path + ".jpeg";

var fileSpec = new File(dest);

var captureOptions = new ImageCaptureOptions();

captureOptions.resolution = 300;

captureOptions.antiAliasing = true;

var curBoard = aiApp.artboards[aiApp.artboards.getActiveArtboardIndex()]

var captureClip = this.curBoard.artboardRect

aiApp.imageCapture(fileSpec, captureClip,captureOptions)

Maybe this would be a solution for you.

Mageshwaran作成者
Inspiring
January 9, 2018

Hi Dane,

Its provide only png format image not jpg.

Thanks,

Magesh

daneJ
Inspiring
January 9, 2018

hmm.

When i run it i get a jpeg.

if you change the extension in line 2 to .png then you certainly get a png.

However I just tryed to open the jpg i made in photoshop and got an error that " an unknown or invalid jpeg marker was found".

Does anybody know what could be causing this?