Redistributes the RGB values of a specific image, using the values
in the
BalanceColorCommandFactor class.
Object Model
Syntax
Example
Run the BalanceColorsCommand on an image.
Visual Basic | Copy Code |
---|
Public Sub BalanceColorsCommandExample()
RasterCodecs.Startup()
Dim codecs As New RasterCodecs()
codecs.ThrowExceptionsOnInvalidImages = True
Dim leadImage As RasterImage = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "Master.jpg")
Dim command As BalanceColorsCommand = New BalanceColorsCommand
command.RedFactor = New BalanceColorCommandFactor(0.25, 0.5, 0.25)
command.GreenFactor = New BalanceColorCommandFactor(0.3, 0.4, 0.3)
command.BlueFactor = New BalanceColorCommandFactor(0.1, 0.6, 0.3)
command.Run(leadImage)
codecs.Save(leadImage, LeadtoolsExamples.Common.ImagesPath.Path + "Result.jpg", RasterImageFormat.Jpeg, 24)
RasterCodecs.Shutdown()
End Sub |
C# | Copy Code |
---|
public void BalanceColorsCommandExample() { // Load an image RasterCodecs.Startup(); RasterCodecs codecs = new RasterCodecs(); codecs.ThrowExceptionsOnInvalidImages = true; RasterImage image = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "Master.jpg"); // Prepare the command BalanceColorsCommand command = new BalanceColorsCommand(); command.RedFactor = new BalanceColorCommandFactor(0.25, 0.50, 0.25); command.GreenFactor = new BalanceColorCommandFactor(0.30, 0.40, 0.30); command.BlueFactor = new BalanceColorCommandFactor(0.10, 0.60, 0.30); command.Run(image); codecs.Save(image, LeadtoolsExamples.Common.ImagesPath.Path + "Result.jpg", RasterImageFormat.Jpeg, 24); RasterCodecs.Shutdown(); } |
Remarks
Inheritance Hierarchy
Requirements
Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
See Also