Copy link to clipboard
Copied
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
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 +=
...Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Hi Dane,
Its provide only png format image not jpg.
Thanks,
Magesh
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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();
////////////////////////////
Copy link to clipboard
Copied
Copy link to clipboard
Copied
@Zain22507017psdl just remane myFolder to dest and this should do the trick