Using a script to export an illustrator file to .jpg with a specified resolution

Posted on 2009-05-20
Medium Priority
Last Modified: 2013-12-02
I want to export an illustrator file to a .jpg and control the resolution.  I can't figure out how to do it.  I get 72 dpi.
Dim appRef As New Illustrator.Application
Dim documentRef As Illustrator.Document, jpgOptions As New Illustrator.ExportOptionsJPEG
jpgOptions.HorizontalScale = 100#
jpgOptions.QualitySetting = 100
jpgOptions.VerticalScale = 100#
appRef.Open ("testfile.eps")
Set documentRef = appRef.Documents("testfile [Converted].eps")
documentRef.Export "testfile.jpg", aiJPEG, jpgOptions

Open in new window

Question by:drjoeusa
1 Comment

Accepted Solution

drjoeusa earned 0 total points
ID: 24446354
I did find a solution that is not very elegant.  I can create an action to do the save in Illustrator.  Then I use 'DoScript' to save the file.  I took out the export line in the sample code and added:
appRef.DoScript "expJPG_CYMK_600", "Default Actions"
Call ShortPause(10#)
If appRef.ActionIsRunning Then
    Call ShortPause(10#)
End If
documentRef.Close aiDoNotSaveChanges
The expJPG_CYMK_600 is the name of the action I recorded.
ShortPause(10#) is a simple VB idle routine for a 10 sec pause to give the action time to complete.  If it isn't complete after 10 seconds, I try another 10 second.  I tried a while appRef.ActionIsRunning loop but got errors.  I'll work on that.

In this case, the file is saved to the default directory and with the default name.  I would prefer to control these but don't know how.

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

HOW TO WARP A RASTER IMAGE AND ADD A REFLECTION USING ADOBE ILLUSTRATOR This tutorial is for experienced to advanced Adobe Illustrator users. Tools and Techniques that will be used in this Tutorial: Flatten Transparency (A) Envelope Distort (B…
In this article, I’ll explain how I make a clipping mask out of several separate vector objects by using the Compound Path option in Adobe Illustrator. A compound path in Illustrator allows grouping of separate objects into one set of vector paths t…
In this tutorial viewers will learn how to use the Pathfinder tool's 4 Shape Modes in Illustrator to create advanced shapes Draw two shapes: A circle and a rectangle: Select both shapes, hold down the Alt key, click and drag to create 4 copies.: Sel…
In this tutorial viewers will learn how to create a vector texture to apply a non-rasterized texture to vector images, using Photoshop and Illustrator Open a textured image such as a scanned-in piece of cardboard in Photoshop: Convert the texture to…

587 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question