How To Render Cars In Photoshop

Learn Photo Editing

Get Instant Access


Parameter Type



Clears the selection and does not copy it to the clipboard.



Number (Double)

Contracts the selection by the specified amount.


( [Merge])


Copies the selection to the clipboard. When the optional argument is used and set to true, a merged copy is performed (all visible layers in the selection are copied).


Clears the current selection and copies it to the clipboard.



Deselects the current selection.



Number (Double)

Expands the selection by the specified amount.



Number (Double)

Feathers the edges of the selection by the specified amount.


[, PreserveTransparency] )

Object (SolidColor, ArtLayer, HistoryState);

Fills the selection (Opacity: 1 -100 as percent).

or String PsColorBlendMode Number (Long) Boolean


Parameter Type


What it does (Continued)


(Tolerance, AntiAlias)

Number (Long) Boolean

Grows the selection to include all adjacent pixels falling within the specified tolerance range.



Inverts the selection (deselects the selection and selects the rest of the layer or document).

Note: To flip the selection shape, see Rotate.



[, Combination] [, Inverting])



Loads the selection from the specified channel.


Number (Double)

Makes this selection item the work path for this document.


([Horizontal] [, Vertical] [, Anchor])

Number (Double) Number (Double) PsAnchorPosition

Resizes the selected area to the specified dimensions and anchor position.


([Horizontal] [, Vertical] [, Anchor])

Number (Double) Number (Double) PsAnchorPosition

Changes the size of the selection to the specified dimensions around the specified anchor.


(Angle [, Anchor])

Number (Double) PsAnchorPosition

Rotates the selection by the specified amount around the specified anchor point.


(Angle [, Anchor])

Number (Double) PsAnchorPosition

Rotates the boundary of the selection around the specified anchor.


(Region [, Type] [, Feather] [, AntiAlias])

Array (Points:

Array (Array (x,y),...) PsSelectionType

Selects the specified region.

Number (Double) Boolean



Selects the entire layer.



Number (Double)

Selects the selection border only (in the specified width); subsequent actions do not affect the selected area within the borders.


Parameter Type


What it does (Continued)


(Tolerance, AntiAlias)

Number (Long) Boolean

Grows the selection to include pixels throughout the image falling within the tolerance range.



Number (Long)

Cleans up stray pixels left inside or outside a color-based selection (within the radius specified in pixels).



Saves the selection as a channel.

(StrokeColor, Width

[, PreserveTransparency] )

Object (color) Number (Long) PsStrokeLocation PsColorBlendMode Number (Long) Boolean

Strokes the selection border (opacity: 1 - 100 as percent).


( [DeltaX] [, DeltaY])

UnitValue UnitValue

Moves the entire selection relative to its current position.


( [DeltaX] [, DeltaY])

UnitValue UnitValue

Moves the selection relative to its current position.

Sample Script

> The following script creates a checkerboard using the following steps:

1. Create an 800 x 800 pixel document.

2. Divide the entire document into 100 x 100 pixel squares.

3. Select every other square in the first row, then shift the selection criteria to select the alternate squares in the following row. Repeat until every other square in the document is selected.

4. Fill the selected squares with the foreground color from the palette.

5. Invert the selection and fill the newly selected squares with the background color from the palette.

6. Deselect the squares to remove the selection outlines (the "marching ants").


Dim appRef, startRulerUnits, startTypeUnits, startDisplayDialogs, docSize Dim cells, cellSize, checkersDoc, shiftIt, h, v, eventWait, enumRedrawComplete Dim typeState, keyState, desc

Set appRef = CreateObject("Photoshop.Application") ' Save the current Preferences startRulerUnits = appRef.Preferences.RulerUnits startTypeUnits = appRef.Preferences.TypeUnits startDisplayDialogs = appRef.DisplayDialogs

' Set Photoshop CS2 to use pixels and display no dialogs appRef.Preferences.RulerUnits = 1 'for PsUnits --> 1 (psPixels) appRef.Preferences.TypeUnits = 1 'for PsTypeUnits --> 1 (psPixels) appRef.DisplayDialogs = 3 'for PsDialogModes --> 3 (psDisplayNoDialogs)

' Close all the open documents Do While appRef.Documents.Count appRef.ActiveDocument.Close Loop

' Create variables for the 800 pixel board divided in even 100 x 100 squares docSize = 800 cells = 8

cellSize = docSize / cells ' create a new document

Set checkersDoc = appRef.Documents.Add(docSize, docSize, 72, "Checkers")

' Create a variable to use for selecting the checker board ' That allows me to shift the selection one square to the right 'on every other row, and then shift back for the rows in between. shiftIt = true

' loop through vertically to create the first row v = 0

For v = 0 To (docSize - 1) Step cellSize ' Switch the shift For a new row shiftIt = Not shiftIt

' loop through horizontally h = 0

For h = 0 To (docSize - 1) Step (cellSize * 2) ' push over the cellSize to start with only If shiftIt And h = 0 Then h = h + cellSize End If

If h = 0 And v = 0 Then checkersDoc.Selection.Select(selRegion) Else checkersDoc.Selection.Select(selRegion, 2) ' for PsSelectionType --> 2 (psExtendSelection) End If

' turn this off for faster execution ' turn this on for debugging WaitForRedraw Next Next

' Fill the current selection with the Foreground color checkersDoc.Selection.Fill(appRef.ForegroundColor)

'Invert the selection checkersDoc.Selection.Invert()

' Fill the new selection with the background color checkersDoc.Selection.Fill(appRef.BackgroundColor)

' Clear the selection to get rid of the non-printing borders checkersDoc.Selection.Deselect()

' Reset the application preferences appRef.Preferences.RulerUnits = startRulerUnits appRef.Preferences.TypeUnits = startTypeUnits appRef.DisplayDialogs = startDisplayDialogs

' A helper function for debugging

' It also helps the user see what is going on

' if you turn it off for this example you

' get a flashing cursor for a Number (Long) time

' Save a bit of time by creating the variables only once

Private Sub WaitForRedraw

If VarType(eventWait) = vbEmpty Then eventWait = appRef.charIDToTypeID("Wait") End If

If VarType(enumRedrawComplete) = vbEmpty Then enumRedrawComplete = appRef.charIDToTypeID("RdCm") End If

If VarType(typeState) = vbEmpty Then typeState = appRef.charIDToTypeID("Stte") End If

If VarType(keyState) = vbEmpty Then keyState = appRef.charIDToTypeID("Stte") End If

If VarType(desc) = vbEmpty Then

Set desc = CreateObject("Photoshop.ActionDescriptor") desc.putEnumerated KeyState, typeState, enumRedrawComplete End If appRef.executeAction(eventWait, desc, 3) 'for PsDialogModes --> 3 (psDisplayNoDialogs) End Sub

Was this article helpful?

+1 0
Learn Photoshop Now

Learn Photoshop Now

This first volume will guide you through the basics of Photoshop. Well start at the beginning and slowly be working our way through to the more advanced stuff but dont worry its all aimed at the total newbie.

Get My Free Ebook

Post a comment