com.groupdocs.watermark

Interfaces

Classes

Exceptions

com.groupdocs.watermark

Class ImageSearchCriteria

  • Direct Known Subclasses:
    ImageColorHistogramSearchCriteria, ImageDctHashSearchCriteria, ImageThumbnailSearchCriteria


    public abstract class ImageSearchCriteria
    extends SearchCriteria

    Provides base class for image search criteria.

    This example demonstrates how to find and remove all possible watermarks containing a particular raster image from a document of any supported format.

    String inputFolder = "D:\\docs\\input\\";
     String outputFolder = "D:\\docs\\output\\";
     String logo = "D:\\docs\\logo.png";
     ImageSearchCriteria imageSearchCriteria = new ImageDctHashSearchCriteria(logo);
     imageSearchCriteria.setMaxDifference(0.1);
     File[] files = new File(inputFolder).listFiles();
     for (File file : files)
     {
         if (file.isFile())
         {
             Document doc = Document.load(file.getAbsolutePath());
             PossibleWatermarkCollection watermarks = doc.findWatermarks(imageSearchCriteria);
             watermarks.clear();
             doc.save(outputFolder + file.getName()); 
         }
     }
     
    • Constructor Detail

      • ImageSearchCriteria

        protected ImageSearchCriteria(String filePath)

        Initializes a new instance of the ImageSearchCriteria class.

        Parameters:
        filePath - The file path to load image from.
      • ImageSearchCriteria

        protected ImageSearchCriteria(InputStream stream)

        Initializes a new instance of the ImageSearchCriteria class.

        Parameters:
        stream - The stream to load image from.
    • Method Detail

      • getMaxDifference

        public final double getMaxDifference()

        Gets maximum allowed difference between images.

        Returns:
        The value should be between 0 and 1. 0 means that only identical images will be found.
      • setMaxDifference

        public final void setMaxDifference(double value)

        Sets maximum allowed difference between images.

        Parameters:
        value - The value should be between 0 and 1. 0 means that only identical images will be found.