• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

file open

Contributor ,
Aug 13, 2015 Aug 13, 2015

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).

     before.png

after.png

   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).

Screen shot 2015-08-14 at 11.35.51 AM.png

   How can I open those files without lose of quality using javascript?

Thanks in advance,

Sudha K

TOPICS
Actions and scripting

Views

884

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Enthusiast ,
Aug 14, 2015 Aug 14, 2015

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);

}

};

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 14, 2015 Aug 14, 2015

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Aug 14, 2015 Aug 14, 2015

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 14, 2015 Aug 14, 2015

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Aug 14, 2015 Aug 14, 2015

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 17, 2015 Aug 17, 2015

Copy link to clipboard

Copied

LATEST

Ok thank you..

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines