Methods

Method

Parameter Type

Returns

What it does

AdjustBrightnessContrast

(Brightness, Contrast)

Number (Long) Number (Long)

Adjusts the brightness (-100 - 100) and contrast (-100 - 100).

AdjustColorBalance

([Shadows] [, Midtones] [, Highlights] [, PreserveLuminosity]

array of Numbers array of Numbers array of Numbers Boolean

Adjusts the color balance of the layer's component channels. For Shadows, Midtones, and Highlights, the array must include three values (-100 - 100), which represent cyan or red, magenta or green, and yellow or blue, when the document mode is CMYK or RGB.

Note: See mode in the Properties table of the Document object.

Method

Parameter Type

Returns

What it does (Continued)

AdjustCurves

(CurveShape)

Array of points (Array (Array(x, y) ))

Adjusts the tonal range of the selected channel using up to fourteen points.

AdjustLevels

(InputRangeStart, InputRangeEnd, InputRangeGamma, OutputRangeStart, OutputRangeEnd)

Number (Long) Number (Long) Number (Double) Number (Long) Number (Long)

Adjusts the levels of the selected channels (InputRangeStart: 0 -253; InputRangeEnd: (InputRangeStart + 2) - 255; InputRangeGamma: 0.10 - 9.99; OutputRangeStart: 0 - 253; OutputRangeEnd: (OutputRangeStart + 2) - 255.

ApplyAddNo ise

(Amount, Distribution, Monochromatic)

Number (Double)

PsNoiseDistribution

Boolean

Applies the Add Noise filter (Amount: 0.1% - 400%).

ApplyAverage

()

Applies the Average filter.

ApplyBlur

()

Applies the Blur filter.

ApplyBlurMore

()

Applies the Blur More filter.

ApplyClouds

()

Applies the Clouds filter.

ApplyCustomFilter

(Characteristics, Scale, Offset)

Array of twenty-five

Numbers (Long) Number (Long) Number (Long)

Note: Required parameter values define the filter. Refer to Adobe Photoshop CS2 Help for specific instructions.

ApplyDeInterlace

(EliminateFields, CreateFields)

PsEliminateFields PsCreateFields

Applies the De-Interlace filter.

ApplyDespeckle

()

Applies the Despeckle filter.

ApplyDifferenceClouds

()

Applies the Difference Clouds filter.

ApplyDiffuseGlow

(Graininess, GlowAmount, ClearAmount)

Number (Long) Number (Long) Number (Long)

(Graininess: 0 - 10; GlowAmount: 0 - 20; ClearAmount: 0 - 20).

Method

Parameter Type

Returns

What it does (Continued)

ApplyDisplace

(AmountScale, VerticalScale, DisplacementType, UndefinedAreas, DisplacementMapFiles)

Number (Long)

Number (Long)

PsDi splacementMapType

PsUndefinedAreas

String

Applies the Displace filter using the specified horizontal and vertical scale (-999 - 999), mapping type, treatment of undistorted areas, and path to the distortion image map.

ApplyDustAndScratches

(Radius, Threshold)

Number (Long) Number (Long)

Applies the Dust & Scratches filter

(Radius: 1 - 100; Threshold: 0 -255).

ApplyGaussianBlur

(Radius)

Number (Double)

Applies the Gaussian Blur filter within the specified radius (in pixels) (0.1 - 250.0).

ApplyGlassEffect

(Distortion, Smoothness, Scaling [, Invert] [, Texture] [, TextureFile])

Number (Long) Number (Long) Number (Long) Boolean PsTextureType File

(Distortion: 0 - 20; Smoothness: 1 - 15; Scaling (in percent): 50 - 200).

ApplyHighPass

(Radius)

Number (Double)

Applies the High Pass filter within the specified radius (in pixels) (0.1 -250.0).

ApplyLensBlur

([Options])

LensBlurOptions

Applies the Lens Blur filter.

ApplyLensFlare

(Brightness, FlareCenter, LensType)

Number (Long)

Array

PsLensType

Applies the Lens Flare filter with the specified brightness (0 - 300%), the x and y coordinates (unit value) of the flare center, and the lens type.

ApplyMaximum

(Radius)

Number (Double)

Applies the Maximum filter within the specified radius (in pixels) (1 -100).

ApplyMedianNoise

(Radius)

Number (Double)

Applies the Median Noise filter within the specified radius (in pixels) (1 - 100).

ApplyMinimum

(Radius)

Number (Double)

Applies the Minimum filter within the specified radius (in pixels) (1 -100).

ApplyMotionBlur

(Angle, Radius)

Number (Long) Number (Double)

Applies the Motion Blur filter (Angle: -360 - 360; Radius: 1 - 999).

ApplyNTSC

()

Applies the NTSC colors filter.

Method

Parameter Type

Returns

What it does (Continued)

ApplyOceanRipple

(Size, Magnitude)

Number (Long) Number (Long)

Applies the Ocean Ripple filter in the specified size (1 - 15) and magnitude (0 - 20).

ApplyOffset

(Horizontal, Vertical, UndefinedAreas)

Number (Double) Number (Double) PsOffsetUndefinedAreas

Moves the layer the specified amount horizontally and vertically (min/max amounts depend on layer size), leaving an undefined area at the layer's original location.

ApplyPinch

(Amount)

Number (Long)

Applies the Pinch filter in the specified amount (as a percentage) (-100 - 100).

ApplyPolarCoordinates

(Conversion)

Ps PolarConversi onType

Applies the Polar Coordinates filter.

ApplyRadialBlur

(Amount, BlurMethod, BlurQuality)

Number (Long)

PsRadialBlurMethod

PsRadialBlurQuality

Applies the Radial Blur filter in the specified amount (1 - 100) using either a spin or zoom effect and the specified quality.

ApplyRipple

(Amount, Size)

Number (Long) PsRippleSize

Applies the Ripple filter in the specified amount (-999 to 999) throughout the image and in the specified size.

ApplySharpen

()

Applies the Sharpen filter.

ApplySharpenEdges

()

Applies the Sharpen Edges filter.

ApplySharpenMore

()

Applies the Sharpen More filter.

ApplyShear

(Curve,

(Array (Array(x, y) )) PsUndefinedAreas

Applies the Shear filter (curve: 2 -255 points).

Note: You must define at least two points in the Curve parameter.

ApplySmartBlur

(Radius, Threshold, BlurQuality, Mode)

Number (Double) Number (Double) PsSmartBlurQuality PsSmartBlurMode

(Radius: 0.1 - 100.0; Threshold: 0.1 - 100.0).

ApplySpherize

(Amount, Mode)

Number (Long) PsSpherizeMode

Applies the Spherize filter in the specified amount (as percentage) (-100 - 100).

Method

Parameter Type

Returns

What it does (Continued)

ApplyStyle

(StyleName)

String

Applies the specified style to the layer.

Note: You must use a style from the Styles list in the Layer Style dialog.

ApplyTextureFill

(TextureFile)

String

Applies the Texture Fill filter.

ApplyTwirl

(Angle)

Number (Long)

Applies the Twirl filter at the specified angle (-999 - 999).

ApplyUnSharpMask

(Amount, Radius, Threshold)

Number (Double) Number (Double) Number (Long)

Applies the Unsharp Mask filter (Amount: 1 - 500 as percent;

Radius: 0.1 - 250.00; Threshold: 0 -255).

ApplyWave

(GeneratorNumber, MinimumWavelength, MaximumWavelength, MinimumAmplitude, MaximumAmplitude, HorizontalScale, VerticalScale, WaveType, UndefinedAreas, RandomSeed)

Number (Long) Number (Long) Number (Long) Number (Long) Number (Long) Number (Long) Number (Long) PsWaveType PsUndefinedAreas Number (Long)

(GeneratorNumber: 1 - 999; MinimumWavelength: 1 - 998; MaximumWavelength: 2 - MinimumWavelength + 1; MinimumAmplitude: 1 - 998; MaximumAmplitude: 2 -MinimumAmplitude + 1; AmountScale: 1% - 100%; VerticalScale: 1% - 100%).

ApplyZigZag

(Amount, Ridges, Style)

Number (Long) Number (Long) PsZigZagType

Applies the Zigzag filter (Amount: -100 - 100; Ridges: 0 - 20).

AutoContrast

()

Adjusts the contrast of the selected channels automatically.

AutoLevels

()

Adjusts the levels of the selected channels using the auto levels option.

Clear

()

Cuts the layer without moving it to the clipboard.

Copy

([Merge])

Boolean

Copies the layer to the clipboard. When the optional argument is set to true, a merged copy is performed (that is, all visible layers are copied to the clipboard).

()

Cuts the layer to the clipboard.

Method

Parameter Type

Returns

What it does (Continued)

Desaturate

()

Converts a color image to a grayscale image in the current color mode by assigning equal values of each component color to each pixel.

Duplicate

([RelativeObject] [, InsertionLocation] )

Object (Layer) PsElementPlacement

Object (Layer)

Creates a duplicate of the object on the screen.

Equalize

()

Redistributes the brightness values of pixels in an image to more evenly represent the entire range of brightness levels within the image.

Invert

()

Inverts the colors in the layer by converting the brightness value of each pixel in the channels to the inverse value on the 256-step color-values scale.

Link

()

Object (Layer)

Links the layer with the specified layer.

Merge

()

ArtLayer

Merges the layer down, removing the layer from the document; returns a reference to the art layer that this layer is merged into.

(Output Channels [, Monochrome] )

array of array of numbers (double) boolean

Modifies a targeted (output) color channel using a mix of the existing color channels in the image. (OutputChannels = An array of channel specifications. For each component channel, specify a list of adjustment values (-200 - 200) followed by a 'constant' value (-200 - 200).)

Note: When Monochrome = true, the maximum number of channel value specifications is 1.

Note: Valid only when

Document.Mode = 2 or Document.Mode = 3.

Note: RGB arrays must include four doubles. CMYK arrays must include five doubles.

Method

Parameter Type

Returns

What it does (Continued)

Move

(ApplicationObject, InsertionLocat ion)

Object (ArtLayer or

LayerSet) PsElementPlacement

Moves the layer relative to the object specified in parameters.

Note: For art layers, only the constant values 3 and 2 are valid.

For layer sets, only the constant values 3 and 0 are valid.

PhotoFilter

[, PreserveLuminosity])

SolidColor Number (Long) Boolean

Adjust the layer's color balance and temperature as if a color filter had been applied (Density: 1% -100%).

Posterize

(Levels)

Number (Long)

Specifies the number of tonal levels (2 - 255) for each channel and then maps pixels to the closest matching level.

Rasterize

(Target)

Ps PurgeTarget

Converts the targeted contents in the layer into a flat, raster image.

Resize

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

Number (Double) Number (Double) PsAnchorPosition

Resizes the layer to the specified dimensions (as a percentage of its current size) and places it in the specified position.

Rotate

(Angle [, Anchor])

Number (Double) PsAnchorPosition

Rotates rotates the layer around the specified anchor point.

SelectiveColor

(SelectionMethod [, Reds] [, Yellows] [, Greens] [, Cyans] [, Blues] [, Magentas] [, Whites] [, Neutrals] [, Blacks])

PsAdjustmentReference Array of Numbers (Long) Array of Numbers (Long) Array of Numbers (Long) Array of Numbers (Long) Array of Numbers (Long) Array of Numbers (Long) Array of Numbers (Long) Array of Numbers (Long) Array of Numbers (Long)

Modifies the amount of a process color in a specified primary color without affecting the other primary colors.

Note: Each color array must have four components.

Method

Parameter Type

Returns

What it does (Continued)

ShadowHighlight

([ShadowAmount] [, ShadowWidth] [, ShadowRadius] [, Highl ightAmount] [, HighlightWidth] [, HighlightRadius] [, ColorCorrection] [, MidtoneContrast] [, BlackClip] [, WhiteClip])

Number (Long) Number (Long) Number (Long) Number (Long) Number (Long) Number (Long) Number (Long) Number (Long) Number (Double) Number (Double)

Adjusts the range of tones in the image's Shadows and highlights

(ShadowAmount: 0 - 100 as percent; ShadowWidth: 0 - 100 as percent; ShadowRadius: 0 - 2500 in pixels;

HighlightAmount: 0 - 100 as percent; HighlightWidth: 0 - 100 as percent; HighlightRadius: 0 -2500 in pixels; ColorCorrection: -100 - 100; MidtoneContrast: -100 - 100; BlackClip: 0.000 - 50.000; WhiteClip: 0.000 - 50.000).

Threshold

(Level)

Number (Long)

Converts grayscale or color images to high-contrast, B/W images by converting pixels lighter than the specified threshold to white and pixels darker than the threshold to black (level: 1 - 255).

translate

( [DeltaX] [, DeltaY])

UnitValue UnitValue

Moves the layer the specified amount (in pixels) relative to its current position.

unlink

()

Unlinks the layer.

Sample Script

The following script closes any open documents (files), then opens each file in the Samples folder, creating an art layer for each image and using the image's file name as the layer name.

ArtLayer.vbs

Dim appRef, startRulerUnits, startTypeUnits, startDisplayDialogs, mergedDoc Dim fsoRef, folderRef, topLeftH, topLeftV, docH, docV, docName, selRegion Dim x, y, layer1, layer2

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 a new document to merge all the samples into

Set mergedDoc = appRef.Documents.Add(100 0, 1000, 72, "Merged Samples", 2, 3, 1) 'enumerated values 2 = PsNewDocumentMode --> 2 (PsNewRGB) and '3 = PsDocumentFill --> 3 (psTransparent)

' get all the files found in this folder

Set fsoRef = CreateObject( "Scripting.FileSystemObject" ) Set folderRef = fsoRef.GetFolder( appRef.Path & "Samples\" )

Randomize

' open each file For Each f in folderRef.Files appRef.Open f.Path

' use the document name for the layer name in the merged document docName = appRef.ActiveDocument.Name

' flatten the document so we get everything and then copy appRef.ActiveDocument.flatten() appRef.ActiveDocument.Selection.SelectAll() appRef.ActiveDocument.Selection.Copy()

' don't save anything we did appRef.ActiveDocument.Close(2)

'the enumerated value Close(2) = PsSaveOptions >2 (psDoNotSaveChanges)

' make a random selection on the document to paste into

' by dividing the document up in 4 quadrants and pasting

' into one of them by selecting that area topLeftH = Int(Rnd() * 2)

' MsgBox topLeftH & ":" & topLeftV

docH = appRef.ActiveDocument.Width / 2

docV = appRef.ActiveDocument.Height / 2

selRegion = Array( Array( topLeftH * docH, topLeftV * docV), _

Array( topLeftH * docH + docH, topLeftV * docV), _ Array( topLeftH * docH + docH, topLeftV * docV + docV), _ Array( topLeftH * docH, topLeftV * docV + docV), _ Array( topLeftH * docH, topLeftV * docV)) appRef.ActiveDocument.Selection.Select(selRegion) appRef.ActiveDocument.Paste()

' change the layer name and opacity appRef.ActiveDocument.ActiveLayer.Name = docName appRef.ActiveDocument.ActiveLayer.FillOpacity = 50 Next

for x = 1 To appRef.ActiveDocument.Layers.Count for y = 1 To appRef.ActiveDocument.Layers.Count - 1 Set layer1 = appRef.ActiveDocument.Layers(y) Set layer2 = appRef.ActiveDocument.Layers(y + 1) If layer1.Name --> layer2.Name Then layer1.move layer2, 4 End If Next

Next

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

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