You need to place the JPEG file in the created illustration document
and obtain a reference to the resulting drawing object. If the drawing
object is a CVImage object, then we get a reference to it.
Set obj = doc.Place(srcFile.Path)
If (obj.Type = cvsImage) Then
Set img = obj.Image
...
End If
Next, you call the Resolution property of the CVImage object to
check whether or not the resolution of the image is higher than 72ppi.
If it is higher, then you use the SetResolution method to set it to
72 ppi.
If (img.Resolution > 72) Then
img.SetResolution 72, False
...
End If
The full destination file path is constructed from the destination
directory and named with a ds_ prefix. The SaveAs method call
saves the downsampled image as a JPEG file to the destination file
path.
dstPath = dstDir + "\" + "ds_" + src-
File.Name
doc.SaveAs dstPath, cvsJPEGFormat
Before continuing with the next file in the source folder, you have to
delete the DrawObject object created by the Place operation.
obj.Delete
After downsampling all of the files, you shut down Canvas by assign-
ing Nothing to the object reference.
Install these scripts on your machine and take them for a test drive.
You can learn more about scripts by visiting our Web site. Make sure
that you visit frequently to obtain new scripts as they become avail-
able.