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



In This Topic
    HasCertainColorCommand Class
    In This Topic
    Checks whether an image contains a certain color.
    Object Model
    HasCertainColorCommand ClassColorBase ClassProcessingCommandResults ClassProcessingCommandResult Class
    Syntax
    'Declaration
     
    Public Class HasCertainColorCommand 
       Inherits Vintasoft.Imaging.ImageProcessing.ProcessingCommandBase
    public class HasCertainColorCommand : Vintasoft.Imaging.ImageProcessing.ProcessingCommandBase 
    public __gc class HasCertainColorCommand : public Vintasoft.Imaging.ImageProcessing.ProcessingCommandBase 
    public ref class HasCertainColorCommand : public Vintasoft.Imaging.ImageProcessing.ProcessingCommandBase 
    Example
    This example shows how to load an image from disk and check whether the image contain certain color.
    Class HasCertainColorCommandExample
        Public Sub ProcessImage()
            ' [ do not forget to set your image file path here! ]
            ' open an existing image
            Dim image As New Vintasoft.Imaging.VintasoftImage("Deskew.tif")
                
            ' create the command
            Dim command As New Vintasoft.Imaging.ImageProcessing.Info.HasCertainColorCommand()
                
            Try
                ' execute the command
                command.ExecuteInPlace(image)
            Catch ex As Vintasoft.Imaging.ImageProcessing.ImageProcessingException
                ' show error message if problem occured
                System.Windows.Forms.MessageBox.Show(ex.Message)
                Return
            End Try
                
            ' show result
            If command.Result Then
                System.Windows.Forms.MessageBox.Show(String.Format("Image has {0} color.", command.Color))
            Else
                System.Windows.Forms.MessageBox.Show(String.Format("Image does not have {0} color.", command.Color))
            End If
        End Sub
    End Class
    class HasCertainColorCommandExample
    {
        public void ProcessImage()
        {
            // [ do not forget to set your image file path here! ]
            // open an existing image
            Vintasoft.Imaging.VintasoftImage image = new Vintasoft.Imaging.VintasoftImage("Deskew.tif");
                
            // create the command
            Vintasoft.Imaging.ImageProcessing.Info.HasCertainColorCommand command =
                new Vintasoft.Imaging.ImageProcessing.Info.HasCertainColorCommand();
                
            try
            {
                // execute the command
                command.ExecuteInPlace(image);
            }
            catch (Vintasoft.Imaging.ImageProcessing.ImageProcessingException ex)
            {
                // show error message if problem occured
                System.Windows.Forms.MessageBox.Show(ex.Message);
                return;
            }
                
            // show result
            if (command.Result)
            {
                System.Windows.Forms.MessageBox.Show(string.Format("Image has {0} color.", command.Color));
            }
            else
            {
                System.Windows.Forms.MessageBox.Show(string.Format("Image does not have {0} color.", command.Color));
            }
        }
    }
    Inheritance Hierarchy

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

    Requirements

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

    See Also