Skip to main content
Inspiring
January 16, 2023
Answered

ExportOptionsJPEG computation and simulation

  • January 16, 2023
  • 2 replies
  • 1015 views

Hi,

Given this parameters:

var exportOptions = new ExportOptionsJPEG();
exportOptions.antiAliasing = true;
exportOptions.horizontalScale = 500;
exportOptions.verticalScale = 500;
exportOptions.qualitySetting = 100;

How did it come up with this properties(see dimensions and resolution properties)?

May I know the computation for this?

Also when exporting JPEG in illustrator, the UI show this:

How can I simulate those values using the scripting way(ExportOptionsJPEG)

This topic has been closed for replies.
Correct answer Doug A Roberts

It's 300 PPI RGB.

I just wanted to know how to simulate the export JPEG in illustrator UI on ExportOptionsJPEG script.

For example: on export UI I selected this options: 300 PPI RGB and then it produces an image with 1613x2682 dimension and 300x300 dpi. What values(vertical/horizontal scale) should I added to ExportOptionsJPEG script to produce the same image?


That would suggest you are exporting from a 387 x 644 px document in Illustrator?

As I said, there is no PPI setting in ExportOptionsJPEG.

If you want a 1613x2682 px file, I suggest you create an artboard that size and use horizontal/verticalScale of 100.

 

Provision for applying PPI appears to have been introduced with the Export for Screens options. See here for some discussion, especially Carlos's post:

https://community.adobe.com/t5/illustrator-discussions/export-jpg-as-300-ppi/m-p/11244200

2 replies

Brainiac
January 16, 2023

You did nothing to set ppi in your code. It is not calculated from your unrelated options. It is not set at all. 96 is a default shown by some viewers; others show a default of 72. 

Inspiring
January 17, 2023

Hi,

I'm just following the guide here: https://ai-scripting.docsforadobe.dev/jsobjref/ExportOptionsJPEG.html

How do I set the PPI here?

Doug A Roberts
Brainiac
January 16, 2023

horizontal/verticalScale is a percentage (e.g. 500% in that instance).

qualitySetting is the compression level (100 = no/minimum compression).

 

What are the dimensions of the original file?

Inspiring
January 16, 2023

See attached for the exact AI file.

This is the image generated using Export as JPEG via illustrator UI

 

This is the image generated using ExportOptionsJPEG via scripting

 

Inspiring
January 16, 2023

Here the details of exported image via Illustrator UI