public BalanceColorsCommand(
BalanceColorCommandFactor redFactor,
BalanceColorCommandFactor greenFactor,
BalanceColorCommandFactor blueFactor
)
- (instancetype)initWithRedFactor:(LTBalanceColorCommandFactor *)redFactor greenFactor:(LTBalanceColorCommandFactor *)greenFactor blueFactor:(LTBalanceColorCommandFactor *)blueFactor NS_DESIGNATED_INITIALIZER;
public BalanceColorsCommand(
BalanceColorCommandFactor redFactor,
BalanceColorCommandFactor greenFactor,
BalanceColorCommandFactor blueFactor
);
public:
BalanceColorsCommand(
BalanceColorCommandFactor^ redFactor,
BalanceColorCommandFactor^ greenFactor,
BalanceColorCommandFactor^ blueFactor
)
__init__(self,redFactor,greenFactor,blueFactor) # Overloaded constructor
redFactor
BalanceColorCommandFactor class that contains the values to use for redistributing the image's red values. Valid values for all class members must be within the range : 0.0 - 100.0.
greenFactor
BalanceColorCommandFactor class that contains the values to use for redistributing the image's green values. Valid values for all class members must be within the range : 0.0 - 100.0.
blueFactor
BalanceColorCommandFactor class that contains the values to use for redistributing the image's blue values. Valid values for all class members must be within the range : 0.0 - 100.0.
Run the BalanceColorsCommand on an image.
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing.Color;
public void BalanceColorsConstructorExample()
{
// Load an image
RasterCodecs codecs = new RasterCodecs();
codecs.ThrowExceptionsOnInvalidImages = true;
RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, @"ImageProcessingDemo\Image2.jpg"));
// Prepare the command
BalanceColorCommandFactor RedFactor = new BalanceColorCommandFactor();
BalanceColorCommandFactor GreenFactor = new BalanceColorCommandFactor();
BalanceColorCommandFactor BlueFactor = new BalanceColorCommandFactor();
RedFactor.ToRed = 0.2;
RedFactor.ToGreen = 0.3;
RedFactor.ToBlue = 0.5;
GreenFactor.ToRed = 0.3;
GreenFactor.ToGreen = 0.1;
GreenFactor.ToBlue = 0.6;
BlueFactor.ToRed = 0.8;
BlueFactor.ToGreen = 0.1;
BlueFactor.ToBlue = 0.1;
BalanceColorsCommand command = new BalanceColorsCommand(RedFactor, GreenFactor, BlueFactor);
command.Run(image);
codecs.Save(image, Path.Combine(LEAD_VARS.ImagesDir, "Result.jpg"), RasterImageFormat.Jpeg, 24);
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images";
}
import java.io.File;
import java.io.IOException;
import org.junit.*;
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
import org.junit.runner.notification.Failure;
import static org.junit.Assert.*;
import leadtools.*;
import leadtools.codecs.*;
import leadtools.imageprocessing.color.*;
public void balanceColorsConstructorExample() {
String LEAD_VARS_IMAGES_DIR = "C:\\LEADTOOLS23\\Resources\\Images";
String outputFilePath = combine(LEAD_VARS_IMAGES_DIR, "Result.jpg");
// Load and Image
RasterCodecs codecs = new RasterCodecs();
codecs.setThrowExceptionsOnInvalidImages(true);
RasterImage image = codecs.load(combine(LEAD_VARS_IMAGES_DIR, "Image2.jpg"));
// Prepare the Command
BalanceColorCommandFactor redFactor = new BalanceColorCommandFactor();
BalanceColorCommandFactor greenFactor = new BalanceColorCommandFactor();
BalanceColorCommandFactor blueFactor = new BalanceColorCommandFactor();
redFactor.setToRed(0.2);
redFactor.setToGreen(0.3);
redFactor.setToBlue(0.5);
greenFactor.setToRed(0.3);
greenFactor.setToGreen(0.1);
greenFactor.setToBlue(0.6);
blueFactor.setToRed(0.8);
blueFactor.setToGreen(0.1);
blueFactor.setToBlue(0.1);
BalanceColorsCommand command = new BalanceColorsCommand(redFactor, greenFactor, blueFactor);
command.run(image);
codecs.save(image, outputFilePath, RasterImageFormat.JPEG, 24);
assertTrue(new File(outputFilePath).exists());
System.out.println("Command run and image saved to " + (outputFilePath));
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document