Article View: adobe.photoshop.scripting
Article #1930Re: VB: Can I adjust brightness and contrast in code?
From: Jonathan_Sundy
Date: Thu, 08 Jul 2004 16:49
Date: Thu, 08 Jul 2004 16:49
32 lines
1962 bytes
1962 bytes
well here is a test program I threw together so we could work this out (your help is greately appreciated)
My compiler is marking my last line in red and telling me that I need an "=" and when i ignore and run it gives me a compile error for syntax.
Just a single form with a button called btnTest
Private Sub btnTest_Click()
Dim appRef As New Photoshop.Application
Dim originalRulerUnits As Photoshop.PsUnits
Set appRef = New Photoshop.Application
originalRulerUnits = appRef.Preferences.RulerUnits
appRef.Preferences.RulerUnits = psInches
Dim docRef As Photoshop.Document
Set docRef = appRef.Documents.Add(1, 1, 600, , psOpenCMYK)
Set docRef = appRef.ActiveDocument
docRef.ArtLayers.Add
Dim selRef As Photoshop.Selection
Dim fillColor As Photoshop.SolidColor
Set fillColor = CreateObject("Photoshop.SolidColor")
fillColor.CMYK.Black = 0
fillColor.CMYK.Cyan = 0
fillColor.CMYK.Magenta = 100
fillColor.CMYK.Yellow = 100
docRef.Selection.Select Array(Array(0, 0), Array(302, 0), Array(302, 302), Array(0, 302)), Type:=psReplaceSelection
Set selRef = docRef.Selection
selRef.Fill fillColor
Dim lyrArtRef As Photoshop.ArtLayer
Set lyrArtRef = docRef.ActiveLayer
lyrArtRef.AdjustBrightnessContrast(-20,20)
End Sub
Technical Details
Message-ID:
<3bb4d6fb.4@webx.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!newsfeed.icl.net!newsfeed.arcor.de!newsfeed01.sul.t-online.de!t-online.de!webxReferences:
<3bb4d6fb.-1@webx.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Thread: f5839,22a610ff7752a142 X-Google-Attributes: gidf5839,public X-Google-Language: ENGLISH,ASCII-7-bit From: Jonathan_Sundy@adobeforums.com Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!newsfeed.icl.net!newsfeed.arcor.de!newsfeed01.sul.t-online.de!t-online.de!webx Newsgroups: adobe.photoshop.scripting Subject: Re: VB: Can I adjust brightness and contrast in code? Message-ID: <3bb4d6fb.4@webx.la2eafNXanI> Date: Thu, 8 Jul 2004 09:49:11 -0700 References: <3bb4d6fb.-1@webx.la2eafNXanI> Lines: 35 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit