Home

QtJP2ImageHandler Class Reference

The QtJP2ImageHandler class provides support for reading and writing JPEG 2000 image files with Qts plugin system. Currently, it only supports dynamically-loaded plugins. More...

 #include <QtJP2ImageHandler>

Inherits QImageIOHandler.

Public Functions

Static Public Members

Additional Inherited Members


Detailed Description

The QtJP2ImageHandler class provides support for reading and writing JPEG 2000 image files with Qts plugin system. Currently, it only supports dynamically-loaded plugins.

JPEG files comes in two subtypes: the JPEG 2000 file format (.jp2) and the JPEG 2000 code stream format (.j2k, .jpc, or .j2c). QtJP2ImageHandler can read and write both types.

To select a subtype, use the setOption() function with the QImageIOHandler::SubType option and a parameter value of "jp2" or "j2k".

To set the image quality when writing, you can use setOption() with the QImageIOHandler::Quality option, or QImageWriter::setQuality() if your are using a QImageWriter object to write the image. The Image quality is specified as an int in the range 0 to 100. 0 means maximum compression and 99 means minimum compression. 100 selects lossless encoding, and this is the default value.

The JPEG handler is only available as a plugin, and this enables you to use normal QImage and QPixmap functions to read and write images. For example:

 myLabel->setPixmap(QPixmap("myimage.jp2"));

 QPixmap myPixmap;
 myPixmap.save("myimage.jp2", "JP2");

Member Function Documentation

QtJP2ImageHandler::QtJP2ImageHandler ( QIODevice * device )

Constructs an instance of QtJP2ImageHandler initialized to use device.

QtJP2ImageHandler::~QtJP2ImageHandler ()   [virtual]

Desctructor for QtJP2ImageHandler.

bool QtJP2ImageHandler::canRead ( QIODevice * iod, QByteArray * subType )   [static]

Verifies if some values (magic bytes) are set as expected in the header of the file. If the magic bytes were found, we assume that we can read the file. The function will assume that the iod is pointing to the beginning of the JPEG 2000 header. (i.e. it will for instance not seek to the beginning of a file before reading).

If subType is not 0, it will contain "jp2" or "j2k" upon successful return.

QByteArray QtJP2ImageHandler::name () const   [virtual]

Return the common identifier of the format. For JPEG 2000 this will return "jp2".

Reimplemented from QImageIOHandler.

QVariant QtJP2ImageHandler::option ( ImageOption option ) const   [virtual]

Get the value associated with option.

Reimplemented from QImageIOHandler.

See also setOption().

void QtJP2ImageHandler::setOption ( ImageOption option, const QVariant & value )   [virtual]

The JPEG 2000 handler supports two options. Set option to QImageIOHandler::Quality to balance between quality and the compression level, where value should be an integer in the interval [0-100]. 0 is maximum compression (low quality) and 100 is lossless compression (high quality).

Set option to QImageIOHandler::Subtype to choose the subtype, where value should be a string equal to either "jp2" or "j2k"

Reimplemented from QImageIOHandler.

See also option().

bool QtJP2ImageHandler::supportsOption ( ImageOption option ) const   [virtual]

This function will return true if option is set to either QImageIOHandler::Quality or QImageIOHandler::Subtype.

Reimplemented from QImageIOHandler.


Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies) Trademarks
Qt Solutions