com.aspose.ocr

Class ImageStream



  • public class ImageStream
    extends Object

    This factory creates objects of “IImageStream” type. This has a set of static methods for creating objects from different input data.


     
     OcrEngine ocr = new OcrEngine();
     ocr.Image = ImageStream.fromFile("image.tiff");
     ocr.Image = ImageStream.fromStream(memoryStream, imageStreamFormat);
     ocr.Image = ImageStream.fromUrl("http://www.someplace.com/images/logo.gif");
     

    • Method Detail

      • fromFile

        public static IImageStream fromFile(String imageFile)

        Creates instance of “IImageStream” from the specified file. This will raise exception if the file not exists or the file format is not supported.

        Parameters:
        imageFile - A string that contains the name of the file from which to create the IImageStream.


                          
                          OcrEngine ocr = new OcrEngine();
                          ocr.setImage(ImageStream.fromFile(@"image.tiff"));
                          

        Returns:
        The IImageStream object.
        Throws:
        OcrException - Thrown when file not exists or format not supported.
      • fromStream

        public static IImageStream fromStream(InputStream stream,
                              int type)

        Creates instance of “IImageStream” object from Stream, parameter "format" sets a data type.

        Parameters:
        stream - The Stream object with image data.
        type - The ImageStreamFormat object sets image format


                       
                       OcrEngine ocr = new OcrEngine();
                       ocr.setImage(ImageStream.fromStream(stream, imageStreamFormat));
                       

        Returns:
        The instance of IImageStream.
      • fromStreamInternal

        public static IImageStream fromStreamInternal(com.aspose.ms.System.IO.Stream stream,
                                      int type)
      • fromUrl

        public static IImageStream fromUrl(String imageUrl)

        Creates instance of “IImageStream” from the specified URL. This will raise exception if the URL is invalid or the file format is not supported.

        Parameters:
        imageUrl - A string that contains the name of the file from which to create the IImageStream.


         
         OcrEngine ocr = new OcrEngine();
         ocr.setImage(ImageStream.fromUrl("http://www.someplace.com/images/logo.gif"));
         

        Returns:
        The IImageStream object.
        Throws:
        OcrException - Thrown when URL is invalid or format not supported.