Esempio n. 1
0
        /**
         * returns an Image representing the given page.
         * @param ra    the file or array containing the image
         * @param page  the page number of the image
         * @return  an Image object
         */
        public static Image GetJbig2Image(RandomAccessFileOrArray ra, int page)
        {
            if (page < 1)
            {
                throw new ArgumentException(MessageLocalization.GetComposedMessage("the.page.number.must.be.gt.eq.1"));
            }

            JBIG2SegmentReader sr = new JBIG2SegmentReader(ra);

            sr.Read();
            JBIG2SegmentReader.JBIG2Page p = sr.GetPage(page);
            Image img = new ImgJBIG2(p.pageBitmapWidth, p.pageBitmapHeight, p.GetData(true), sr.GetGlobal(true));

            return(img);
        }
Esempio n. 2
0
        /**
         * returns an Image representing the given page.
         * @param ra    the file or array containing the image
         * @param page  the page number of the image
         * @return  an Image object
         */
        public static Image GetJbig2Image(RandomAccessFileOrArray ra, int page)
        {
            if (page < 1)
            {
                throw new ArgumentException("The page number must be >= 1.");
            }

            JBIG2SegmentReader sr = new JBIG2SegmentReader(ra);

            sr.Read();
            JBIG2SegmentReader.JBIG2Page p = sr.GetPage(page);
            Image img = new ImgJBIG2(p.pageBitmapWidth, p.pageBitmapHeight, p.GetData(true), sr.GetGlobal(true));

            return(img);
        }