VintaSoft Imaging .NET SDK v8.7
Vintasoft.Imaging.ImageProcessing.Info Namespace / GetBackgroundColorCommand Class
Members Example



In This Topic
    GetBackgroundColorCommand Class
    In This Topic
    Detects a background color of an image.
    Object Model
    GetBackgroundColorCommand ClassProcessingCommandResults ClassProcessingCommandResult Class
    Syntax
    'Declaration
     
    Public Class GetBackgroundColorCommand 
       Inherits Vintasoft.Imaging.ImageProcessing.ProcessingCommandBase
    public class GetBackgroundColorCommand : Vintasoft.Imaging.ImageProcessing.ProcessingCommandBase 
    public __gc class GetBackgroundColorCommand : public Vintasoft.Imaging.ImageProcessing.ProcessingCommandBase 
    public ref class GetBackgroundColorCommand : public Vintasoft.Imaging.ImageProcessing.ProcessingCommandBase 
    Example
    This example shows how to load an image from disk and determine the background color in the image.
    Class GetBackgroundColorCommandExample
    	Public Sub ProcessImage()
    		' open an image from file
    		Dim image As New Vintasoft.Imaging.VintasoftImage("Deskew.tif")
                
    		' create the command
    		Dim command As New Vintasoft.Imaging.ImageProcessing.Info.GetBackgroundColorCommand()
                
    		Try
    			' execute the command
    			command.ExecuteInPlace(image)
    		Catch ex As Vintasoft.Imaging.ImageProcessing.ImageProcessingException
    			' show error message if error occured
    			System.Windows.Forms.MessageBox.Show(ex.Message)
    			Return
    		End Try
                
    		' show result
    		If command.IsBackgroundColorFound Then
    			System.Windows.Forms.MessageBox.Show(String.Format("Background color of image is {0}.", command.BackgroundColor))
    		Else
    			System.Windows.Forms.MessageBox.Show("Background color of image is not found.")
    		End If
    	End Sub
    End Class
    class GetBackgroundColorCommandExample
    {
        public void ProcessImage()
        {
            // open an image from file
            Vintasoft.Imaging.VintasoftImage image = new Vintasoft.Imaging.VintasoftImage("Deskew.tif");
                
            // create the command
            Vintasoft.Imaging.ImageProcessing.Info.GetBackgroundColorCommand command =
                new Vintasoft.Imaging.ImageProcessing.Info.GetBackgroundColorCommand();
                
            try
            {
                // execute the command
                command.ExecuteInPlace(image);
            }
            catch (Vintasoft.Imaging.ImageProcessing.ImageProcessingException ex)
            {
                // show error message if error occured
                System.Windows.Forms.MessageBox.Show(ex.Message);
                return;
            }
                
            // show result
            if (command.IsBackgroundColorFound)
            {
                System.Windows.Forms.MessageBox.Show(string.Format("Background color of image is {0}.", command.BackgroundColor));
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("Background color of image is not found.");
            }
        }
    }
    Inheritance Hierarchy

    System.Object
       Vintasoft.Imaging.ImageProcessing.ProcessingCommandBase
          Vintasoft.Imaging.ImageProcessing.Info.GetBackgroundColorCommand

    Requirements

    Target Platforms: Windows 10, Windows 8, Windows 7, Windows Vista, Windows XP, Windows Server 2012, Windows Server 2008, Windows Server 2003

    See Also