com.groupdocs.watermark

Interfaces

Classes

Exceptions

com.groupdocs.watermark

Class ImageThumbnailSearchCriteria



  • public class ImageThumbnailSearchCriteria
    extends ImageSearchCriteria

    Represents search criteria for finding images in a document. This search criteria uses image binarized thumbnail for calculating image similarity.

    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 ImageThumbnailSearchCriteria(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

      • ImageThumbnailSearchCriteria

        public ImageThumbnailSearchCriteria(String filePath)

        Initializes a new instance of the ImageThumbnailSearchCriteria class.

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

        public ImageThumbnailSearchCriteria(InputStream stream)

        Initializes a new instance of the ImageThumbnailSearchCriteria class.

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

      • getThumbnailSize

        public final byte getThumbnailSize()

        Gets thumbnail size.

        Returns:
        By default 32X32 thumbnail will be used.
      • setThumbnailSize

        public final void setThumbnailSize(byte value)

        Sets thumbnail size.

        Parameters:
        value - By default 32X32 thumbnail will be used.