Resample Project Images to 100%
Version: 1.2
Series: "Flip - Resize - Skew - Rotate - Crop" (FRSRC)

An InDesign CS2-CS3 JavaScript
OS: Mac OS X, Windows XP

The script is intended to batch process the resize of raster images of InDesign-Documents
in a selected folder to 100% scaling while maintaining necessary and importance of effective resolution. 
It also transforms the image according to the Rotation and Skew Angles. 

When you run the script must select a project folder, which contains document subfolders
(documents and folders with linked graphics files). 
The number and names found documents showing in the script options dialog.

The script will skip over and not process:
1) Missing, Modified, Embedded Links, embedded images saved in folder "Embedded Images";
2) Files with vector data (AI, PDF, EPS(Ai)...);
3) CompuServe GIF-files - mode "Save As Is" (native resolution only 72 Ppi);
4) Files in Folder with name "Excludes" (const exclFolderName = "Excludes").

Transformed images stored in a folder named "Links", which was created in the directory of the .indd document.
The files with similar names (without extension)are assigned indexes: "100pc" and duplicates are incremented from 1.
Folder name and the index "100pc" can be edited to change the initialization file:
const outFolderName = "Links"; const outFileIndex = "100pc" (default values).

Transforming all Channels, Layers and Paths of Images.
For all Layers of the Images (including groups - Layer Sets) execute commands Unlink and Unlocked.
For the transformation Effects, applied to the Layers, realized Convert Layers to Smart Objects.
With the transformation of images in Adobe Photoshop selected "white" for Background and Foreground Colors (rgb: 255, 255, 255).

Script Options:
(script options are stored in the file "PrjImages100pc.txt", which is created at first start)
1) "Save JPG or PSD or EPS As:" - choose one of three formats of graphics files for save transformed copies as:
• IS - stored in original format,
• PSD - save in the format of Photoshop Document,
• TIFF - save in the format TIFF,
• EPS - save in the format Photoshop EPS;
2) "Save Other Graphic Files As:" - the choice of format for save of the remaining transformed files:
• IS - to transform a copy of the file (stored in original format)
• PSD - save in the format of Photoshop Document,
• TIFF - save in the format TIFF,
• EPS - save in the format Photoshop EPS; 
(Flatten Image - while maintaining the format Photoshop EPS merge visible layers of the original image);
3) "Merge Visible Layers" - convert "visible layers" of images in a single layer,
• "Flatten Image" - to convert all layers of the image in one - Background, excluding the "invisible";
4) "Convert Layers to Smart Objects" - conversion of all layers of the image, except Background, in Smart Objects;
5) "Output Resolution, (pixels / inch)" - the resulting image resolution, dpi (from 36 to 2540);
6) "Step resizing factor, (%)" - step-by-step rate change authorization, the default value - 30
(increase or decrease image resolution at 30% for one operation Resize,
values relations with effective and result permits more or less than 1.30, respectively, 0.85);
7) "Crop Image" - crop the image:
"Picture Box Bleed, (mm)" - the value of symmetrical bleed beyond the image frame;
8) "Select Resample Method" (the choice of resample image algorithm) -
• the importance of "Off" used automatic choice Resample Method (var selAutoRsmpMth = true):
BICUBICSMOOTHER - increases image resolution,
BICUBICSHARPER - reduction;
• at the "On" is one of the selected methods for resample all images:
BICUBIC, BILINEAR, NEARESTNEIGHBOR, BICUBICSMOOTHER, BICUBICSHARPER;
9) "Relink to transformed files" - relink images to transformed files
performed script in InDesign, the image applies:
• Rotation and Shear X Angle - 0 °,
• Vertical and Horizontal Scale  - 100%;
• Center Content - picture frame positioned at the center if active adjustment "Crop Image",
• Return Clipping Path Settings - the return of baseline settings for Clipping Path
(saved only for Photoshop Path, for the rest: Alpha Channel, User-Modified Path and Detect Edges set to"None");
10) "Create a copy of the document" - create a copy of the document to replace the images transformed files
(a copy created in the document folder, name formed from the name of the document and index "_100pc.indd");
11) "Relink Step Mode" - step-by-step mode replacement the images for each documents;
12) TIFF Save Encoding: const outTiffSaveEncoding - the type of encryption while maintaining the format TIFF:
JPEG, NONE, TIFFLZW, TIFFZIP (by default - "NONE");
13) EPS Save Encoding: const outEpsSaveEncoding - the type of encryption while maintaining the format of Photoshop EPS:
ASCII, BINARY, JPEGHIGH, JPEGLOW, JPEGMAXIMUM, JPEGMEDIUM (by default - "JPEGMAXIMUM");
14) Photoshop Dialog Modes: const phpDialogModes - displaying Adobe Photoshop program dialogs in the performance of the script:
• DialogModes.ERROR - displayed only error messages,
• DialogModes.ALL - shows all the dialogs,
• DialogModes.NO - dialogs are not displayed (by default);
15) const remColorProfile - when "true" transformed files are stored without the built-profile
(ignored while preserving images in the original document format - "Save As Is", by default - "false");
16) const exclFolderName - the name of the folder with related images, which do not require processing(ignored);
17) const outFolderName = "Links" - the name of the Output Folder for processed files;
18) const outFileIndex = "100pc" - index in the names of processed files;

The transfer and run script in Photoshop and back to InDesign (Relink) functions performed by BridgeTalk.
Installed Programs Photoshop and InDesign should be one version of Creative Suite (CS).

© 2008 Dmitriy Lapaev (d.lapaev@gmail.com)