EDOBE XDOM EM Spécifications Page 94

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 231
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 93
Adobe Photoshop CS6
JavaScript Scripting Reference JavaScript Object Reference 94
Document sample script
The following script creates a document that contains two images (a sunflower and a duck) obtained from
the Adobe Photoshop CS6 Samples folder and employs the following steps:
Determines which image is larger.
Resizes the smaller image to match the larger image.
Creates a merged document twice as high as either image in order to hold both images.
Selects part of the document and pastes the sunflower into the selection.
Inverts the selection and pastes the duck into the lower part of the document.
Positions the sunflower over the duck.
Document.jsx
// Save the current preferences
var startRulerUnits = app.preferences.rulerUnits
var startTypeUnits = app.preferences.typeUnits
var startDisplayDialogs = app.displayDialogs
// Set Adobe Photoshop CS6 to use pixels and display no dialogs
app.preferences.rulerUnits = Units.PIXELS
app.preferences.typeUnits = TypeUnits.PIXELS
app.displayDialogs = DialogModes.NO
// first close all the open documents
while (app.documents.length) {
app.activeDocument.close()
}
// Open the sunflower and duck files from the samples folder
var flowerDoc = open(File(app.path + "/Samples/Sunflower.psd"))
var duckDoc = open(File(app.path + "/Samples/Ducky.tif"))
// Find out which document is larger
// Resize the smaller document the to the larger document’s size
// The resize requires the document be the active/front document
if ((flowerDoc.width.value * flowerDoc.height.value) >
(duckDoc.width.value * duckDoc.height.value)) {
app.activeDocument = duckDoc
duckDoc.resize(flowerDoc.width, flowerDoc.height)
}
else {
app.activeDocument = flowerDoc
flowerDoc.resizeImage(duckDoc.width, duckDoc.height)
}
// Create a new document twice as high as two files
var mergedDoc = app.documents.add(duckDoc.width, duckDoc.height * 2,
duckDoc.resolution, "FlowerOverDuck")
// Copy the flower to the top; make it the active document so we can manipulate it
app.activeDocument = flowerDoc
flowerDoc.activeLayer.copy()
//Paste the flower to the merged document, making the merged document active
app.activeDocument = mergedDoc
// Select a square area at the top of the new document
Vue de la page 93
1 2 ... 89 90 91 92 93 94 95 96 97 98 99 ... 230 231

Commentaires sur ces manuels

Pas de commentaire