|
JIU 0.12.0 Homepage | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.jiu.ops.Operation
net.sourceforge.jiu.codecs.ImageCodec
net.sourceforge.jiu.codecs.tiff.TIFFCodec
A codec to read Tagged Image File Format (TIFF) image files.
TIFFCodec codec = new TIFFCodec(); codec.setFile("image.tif", CodecMode.LOAD); codec.process(); PixelImage loadedImage = codec.getImage();Saving images is not supported by this codec.
TIFFDecoderUncompressed
.TIFFDecoderPackbits
.TIFFDecoderModifiedHuffman
.TIFFDecoderDeflated
.TIFFDecoderLogLuv
.
Note that you can write your own decoder (extending TIFFDecoder
) for any compression type
you want.
BilevelImage
.Gray8Image
.
Note that you can write your own decoder (extending TIFFDecoder
) for any compression type
you want.
Writing TIFFs is not supported. I don't know if or when it will be supported.
Later, the concept of tiles was added to the TIFF specs. Tiled TIFFs are separated into rectangles that not only had a defineable height but also a defineable width (tile width and tile height are also stored in corresponding tags).
Obviously, strips are just a special case of tiles, with the tile width being equal to image width. That is why JIU internally only deals with tiles. The only difference: No row padding takes place for strips. In a tiled image with a tile height of 10 and an image height of 14, the image is two tiles high.
ImageCodec.getImageIndex()
and skips to the
correct image.
ImageCodec.getDpiX()
and ImageCodec.getDpiY()
.
TIFF was created by Aldus and now belongs to Adobe, who offer a specification document: TIFF (Tagged Image File Format) 6.0 Specification (updated on Web September, 20 1995, document dated June, 3 1992) (PDF: 385 KB / 121 pages).
Other good references include the homepage of libtiff, a free C library to read and write TIFF files and The Unofficial TIFF homepage by Niles Ritter. Also see the TIFF section of the Open Directory.
TIFF is used for various specialized tasks. As an example, see GeoTIFF (geographical data) or EXIF (digital camera metadata; this is actually a TIFF directory embedded in a JPEG header).
Here's a list of features that make TIFF quite complex:
Field Summary | |
static int |
BYTE_ORDER_INTEL
|
static int |
BYTE_ORDER_MOTOROLA
|
Constructor Summary | |
TIFFCodec()
|
Method Summary | |
int |
getByteOrder()
Returns the current byte order, either BYTE_ORDER_INTEL or
BYTE_ORDER_MOTOROLA . |
String |
getFormatName()
Returns the name of the file format supported by this codec. |
String[] |
getMimeTypes()
Return the MIME (Multipurpose Internet Mail Extensions) type strings for this format, or null
if none are available. |
static String |
getTagName(int id)
Returns the name of a tag in English. |
boolean |
isLoadingSupported()
Returns if this codec is able to load images in the file format supported by this codec. |
boolean |
isSavingSupported()
Returns if this codec is able to save images in the file format supported by this codec. |
void |
process()
This method does the actual work of the operation. |
static void |
registerDecoder(Class decoderClass)
Register a TIFFDecoder class.
|
void |
setFile(String fileName,
CodecMode codecMode)
Gives a file name and codec mode to the codec which will then try to create the corresponding I/O object. |
Methods inherited from class net.sourceforge.jiu.ops.Operation |
addProgressListener, addProgressListeners, getAbort, removeProgressListener, setAbort, setProgress, setProgress |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int BYTE_ORDER_MOTOROLA
public static final int BYTE_ORDER_INTEL
Constructor Detail |
public TIFFCodec()
Method Detail |
public int getByteOrder()
BYTE_ORDER_INTEL
or
BYTE_ORDER_MOTOROLA
.
public String getFormatName()
ImageCodec
ImageCodec
must override this method.
When overriding, leave out any words in a particular language so
that this format name can be understood by everyone.
Usually it is enough to return the format creator plus a typical
abbreviation, e.g. Microsoft BMP
or Portable Anymap (PNM)
.
getFormatName
in class ImageCodec
public String[] getMimeTypes()
ImageCodec
null
if none are available.
getMimeTypes
in class ImageCodec
public static String getTagName(int id)
id
- of the tag for which a name is to be returned
?
public boolean isLoadingSupported()
ImageCodec
true
is returned this does not necessarily mean that all files in this
format can be read, but at least some.
isLoadingSupported
in class ImageCodec
public boolean isSavingSupported()
ImageCodec
true
is returned this does not necessarily mean that all types files in this
format can be written, but at least some.
isSavingSupported
in class ImageCodec
public void process() throws MissingParameterException, OperationFailedException
Operation
process
in class Operation
MissingParameterException
- if any mandatory parameter was not given to the operation
OperationFailedException
public static void registerDecoder(Class decoderClass)
TIFFDecoder
class.
TIFF knows many compression types, and JIU only supports some of them.
To register an external TIFFDecoder class with TIFFCodec, call this method
with the class field of your decoder.
As an example, for your TIFFDecoderMyCompression class,
call TIFFCodec.registerDecoder(TIFFDecoderMyCompression.class)
.
It will be checked if
decoderClass.newInstance() instanceof TIFFDecoder
is true and, if so, the class will be added to an internal list.
Whenever a TIFF file is to be decoded, the correct decoder is determined
(each decoder knows about the compression types it supports via the getCompressionTypes method)
and for each tile or strip such a decoder object will be created.
public void setFile(String fileName, CodecMode codecMode) throws IOException, UnsupportedCodecModeException
ImageCodec
setFile
in class ImageCodec
fileName
- name of the file to be used for loading or savingcodecMode
- defines whether file is to be used for loading or saving
IOException
UnsupportedCodecModeException
|
JIU 0.12.0 Homepage | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |