/*** * Gets the number of pages in a JBIG2 image. * @param ra a random acces file array containing a JBIG2 image * @return the number of pages */ public static int GetNumberOfPages(RandomAccessFileOrArray ra) { JBIG2SegmentReader sr = new JBIG2SegmentReader(ra); sr.Read(); return(sr.NumberOfPages()); }
/** * Gets a byte array that can be used as a /JBIG2Globals, * or null if not applicable to the given jbig2. * @param ra an random access file or array * @return a byte array */ public static byte[] GetGlobalSegment(RandomAccessFileOrArray ra) { try { JBIG2SegmentReader sr = new JBIG2SegmentReader(ra); sr.Read(); return(sr.GetGlobal(true)); } catch { return(null); } }
/** * Gets a byte array that can be used as a /JBIG2Globals, * or null if not applicable to the given jbig2. * @param ra an random access file or array * @return a byte array */ public static byte[] GetGlobalSegment(RandomAccessFileOrArray ra ) { try { JBIG2SegmentReader sr = new JBIG2SegmentReader(ra); sr.Read(); return sr.GetGlobal(true); } catch { return null; } }
/** * 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); }
public JBIG2Page(int page, JBIG2SegmentReader sr) { this.page = page; this.sr = sr; }
/** * 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; }
/*** * Gets the number of pages in a JBIG2 image. * @param ra a random acces file array containing a JBIG2 image * @return the number of pages */ public static int GetNumberOfPages(RandomAccessFileOrArray ra) { JBIG2SegmentReader sr = new JBIG2SegmentReader(ra); sr.Read(); return sr.NumberOfPages(); }