scantools  1.0.4
Graphics manipulation with a view towards scanned documents
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
imageInfo Class Reference

Trivial class to store elementary info about bitmap graphics. More...

#include <imageInfo.h>

Collaboration diagram for imageInfo:
Collaboration graph
[legend]

Public Member Functions

 imageInfo (imageInfo const &)=default
 Copy constructor.
 
 imageInfo ()
 Default constructor. More...
 
 imageInfo (const QImage &image)
 Constructs an image info from a QImage. More...
 
 imageInfo (const QString &fileName)
 Constructs an image info from a file. More...
 
void clear ()
 Sets all values to zero.
 
bool read (const QImage &image)
 Reads image info from a QImage. More...
 
bool read (const QString &fileName)
 Read image info from an image file. More...
 
bool isEmpty () const
 Checks if image is empty. More...
 
resolution xResolution () const
 Vertical resolution. More...
 
resolution yResolution () const
 Horizontal resolution. More...
 
 operator QString () const
 Converts the image info to a human readable string. More...
 

Static Public Member Functions

static QList< imageInforeadAll (const QString &fileName)
 Construct image infos for all images in a file. More...
 

Public Attributes

QString error
 Error string.
 
quint32 heightInPixel {}
 Image height in pixels.
 
quint8 numberOfColorComponents {}
 Number of color components.
 
quint32 widthInPixel {}
 Image width in pixels.
 
resolution _xResolution
 Horizontal resolution of the image, in dots per inch.
 
resolution _yResolution
 Horizontal resolution of the image, in dots per inch.
 

Detailed Description

Trivial class to store elementary info about bitmap graphics.

Definition at line 30 of file imageInfo.h.

Constructor & Destructor Documentation

◆ imageInfo() [1/3]

imageInfo::imageInfo ( )

Default constructor.

The default constructor sets all values to zero and clears the error string.

◆ imageInfo() [2/3]

imageInfo::imageInfo ( const QImage &  image)
inline

Constructs an image info from a QImage.

This constructor simply calls read(const QImage &)

Parameters
imageA QImage whose data is read

Definition at line 49 of file imageInfo.h.

◆ imageInfo() [3/3]

imageInfo::imageInfo ( const QString &  fileName)
inlineexplicit

Constructs an image info from a file.

This constructor simply calls read(const QString &)

Parameters
fileNameName of input image file

Definition at line 59 of file imageInfo.h.

Member Function Documentation

◆ isEmpty()

bool imageInfo::isEmpty ( ) const
inline

Checks if image is empty.

Returns
True if width or height are zero

Definition at line 112 of file imageInfo.h.

◆ operator QString()

imageInfo::operator QString ( ) const
inline

Converts the image info to a human readable string.

This is useful mainly for debugging purposes

Returns
QString describing the image

Definition at line 138 of file imageInfo.h.

◆ read() [1/2]

bool imageInfo::read ( const QImage &  image)

Reads image info from a QImage.

Parameters
imageA QImage whose data is read
Returns
False if the image has format QImage::Format_Invalid, and True otherwise.

◆ read() [2/2]

bool imageInfo::read ( const QString &  fileName)

Read image info from an image file.

This method reads an image file and inteprets the information found there. If the file contains more than one image (e.g. if the file is a multi-page TIFF file), only the first image is considered.

If fileName points to a JPEG or JPEG2000 file (in JP2 or JPX format), the data is read without decoding the image data. The method is therefore rather inexpensive in these cases. In case of error, an error message is saved in the 'error' member, and all other members are set to their default values.

Parameters
fileNameName of an image file in JBIG2, JPEG or JPEG2000 format, or in any other format that Qt can read.
Returns
False if the image file could not be read, and True otherwise.

◆ readAll()

static QList<imageInfo> imageInfo::readAll ( const QString &  fileName)
static

Construct image infos for all images in a file.

This method constructs an image info for every image contained in the file.

Note
Currently, only TIFF and JBIG2 files are supported. For all other file types, only the first image is read.
Parameters
fileNameName of an image file in JBIG2, JPEG or JPEG2000 format, or in any other format that Qt can read.
Returns
A list of image infos, or an empty list in case of error

◆ xResolution()

resolution imageInfo::xResolution ( ) const
inline

Vertical resolution.

Returns
Vertical resolution

Definition at line 120 of file imageInfo.h.

◆ yResolution()

resolution imageInfo::yResolution ( ) const
inline

Horizontal resolution.

Returns
Horizontal resolution

Definition at line 128 of file imageInfo.h.


The documentation for this class was generated from the following file: