phelps.imageio.plugins
Class Fax
public
class
Fax
extends Object
World's fastest Java-based CCITT FAX decoding (Group 3 1-D and Group 4), and high-quality scaling.
Does no cacheing; always creates new image.
Since FAX images are often 8MB in size (say, 2560x3300 pixels), performance is extremely important.
Doesn't fit into Image I/O framework because FAX bitstream doesn't contain necessary metadata.
Used by PDF and could by used by a TIFF decoder.
WANTED: Test data for Group 3 2-D.
Version: $Revision: 1.10 $ $Date: 2003/04/26 03:04:05 $
Method Summary |
static BufferedImage | decode(int K, int cols, int rows, InputStream in) |
static BufferedImage | decode(int K, int cols, int rows, boolean EndOfLine, boolean EndOfBlock, boolean EncodedByteAlign, byte WHITE, int DamagedRowsBeforeError, InputStream in)
Highly optimized decoder. |
static void | encode(int K, BufferedImage img, OutputStream out)
Encode image as FAX -- only Group 3 implemented (which produces valid, but larger Group 4).
|
static BufferedImage | scale(BufferedImage img, AffineTransform iat)
High quality and performance-optimized custom scaler for FAX images.
|
public static BufferedImage decode(int K, int cols, int rows, InputStream in)
public static BufferedImage decode(int K, int cols, int rows, boolean EndOfLine, boolean EndOfBlock, boolean EncodedByteAlign, byte WHITE, int DamagedRowsBeforeError, InputStream in)
Highly optimized decoder.
Parameters: K <0 for Group 4, 0 for Group 3, >0 for Group 3 2-D cols number of columns in decoded image rows number of rows in decoded image. If this is not known, pass a negative number whose absolute value is an estimate, or pass 0 for an estimate computed from the number of columns. Performance relies in accurate estimates. WHITE value of white pixel, 0 or 1 in data (should be buffered somehow, such as BufferedInputStream or ByteArrayInputStream)
public static void encode(int K, BufferedImage img, OutputStream out)
Encode image as FAX -- only Group 3 implemented (which produces valid, but larger Group 4).
Source image is interpreted as bi-tonal as follows: black pixel in source = black in FAX, non-black = white.
Parameters: K <0 Group 4 (yields highest compression), >=0 Group 3 1D
public static BufferedImage scale(BufferedImage img, AffineTransform iat)
High quality and performance-optimized custom scaler for FAX images.
Produces 8-bit indexed grayscale image:
8-bit to (more or less) match screen depth (and avoid length conversions from 1/2/4 bits during selection and lens dragging),
grayscale for quality,
and indexed for transparent pixels for selections and highlight annotations.
Should only be used with BufferedImage's made by decode().
At present, shearing is ignored.