Copy link to clipboard
Copied
Hi,
I am converting files to JPG. When I am using file open without open options, the quality of the image is lost. I am using multiple file types (AI, PSD, TIFF, JPG, PNG, EPS).
var doc = open(fileRef);
When I am using multiple file types, how can I use openoptions for those files?? Reference guide having open options for EPS, PDF (Refer below screen shot).
How can I open those files without lose of quality using javascript?
Thanks in advance,
Sudha K
Copy link to clipboard
Copied
Here is an example.
main();
function main(){
var pdfOpenOptions = new PDFOpenOptions();
pdfOpenOptions.antialias = true;
pdfOpenOptions.suppressWarnings = true;
pdfOpenOptions.usePageNumber = true;
pdfOpenOptions.page = 1;
pdfOpenOptions.bitsPerChannel = BitsPerChannelType.EIGHT;
pdfOpenOptions.resolution = 300; //Amend to suit
pdfOpenOptions.mode = OpenDocumentMode.RGB;
pdfOpenOptions.cropPage = CropToType.BLEEDBOX;
var selectedFolder = Folder.selectDialog( "Please select input folder");
if(selectedFolder == null ) return;
var fileList = selectedFolder.getFiles(/\.(ai|psd|tif|tiff|jpg|png|eps)$/i);
for(var a in fileList){
var EXT = decodeURI(fileList.name).toLowerCase().match(/[^\.]+$/);
switch(EXT){
case 'pdf' :
case 'eps' :
case 'ai' : open(fileList,pdfOpenOptions); break;
default : open(fileList);
}
//Your code here.
//app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
}
};
Copy link to clipboard
Copied
Hi,
You have used pdfOpenOptions for an "AI" files alone. default file open is without openoptions.
Still getting the same issue. EPS will open using default one??
- Sudha K
Copy link to clipboard
Copied
In the example pdf,eps and ai will open with pdfOpenOptions anything else will use the default.
You could amend the PPI to suit your needs.
Copy link to clipboard
Copied
Ok. My doubt is if we open eps without openoptions, will it cause any quality issue??
Using Reference Guide, I can use eps options for eps file, pdf options for pdf file. For other kinds of file, which open option need to use to avoid quality or other issues?
Copy link to clipboard
Copied
You can amend the switch statement to suit your needs.
It looks as you have a problem with the output, so open one the files with the problem and do some tests with saving the jpg.
It might be a problem with the way you are saving the file.
Copy link to clipboard
Copied
Ok thank you..