JPEGCompressor Class Reference

Wrapper class to the IJG JPEG library. More...

`#include <JPEGCompressor.h>`

Inheritance diagram for JPEGCompressor:

## Public Member Functions

| JPEGCompressor (int quality)
| Constructor.
void | setQuality (int factor)
| Set the compression quality.
int | getQuality ()
| Get the current quality level.
void | InitCompression (const RawTile &rawtile, unsigned int strip_height)
| Initialise strip based compression.
unsigned int | CompressStrip (unsigned char *s, unsigned char *o, unsigned int tile_height)
| Compress a strip of image data.
unsigned int | Finish (unsigned char *output)
| Finish the strip based compression and free memory.
unsigned int | Compress (RawTile &t)
| Compress an entire buffer of image data at once in one command.
unsigned int | getHeaderSize ()
| Return the JPEG header size.
unsigned char * | getHeader ()
| Return a pointer to the header itself.
const char * | getMimeType ()
| Return the JPEG mime type.
const char * | getSuffix ()
| Return the image filename suffix.
Public Member Functions inherited from Compressor
int | getQuality ()
| Get the current quality level.
void | setICCProfile (const std::string &profile)
| Set the ICC profile.
void | setXMPMetadata (const std::string &x)
| Set XMP metadata.
virtual void | addXMPMetadata (const std::string &m)
| Add metadata to the image header.

## Additional Inherited Members

Protected Attributes inherited from Compressor
int | Q
| Quality level.
std::string | icc
| ICC Profile.
std::string | xmp
| XMP metadata.

## Detailed Description

Wrapper class to the IJG JPEG library.

## Constructor & Destructor Documentation

## JPEGCompressor()

JPEGCompressor::JPEGCompressor | ( | int | quality | ) |

inline

Constructor.

Parameters

  quality | JPEG Quality factor (0-100)

## Member Function Documentation

## Compress()

unsigned int JPEGCompressor::Compress | ( | RawTile & | t | ) |

virtual

Compress an entire buffer of image data at once in one command.

Parameters

  t | tile of image data

Reimplemented from Compressor.

## CompressStrip()

unsigned int JPEGCompressor::CompressStrip | ( | unsigned char * | s,
|  | unsigned char * | o,
|  | unsigned int | tile_height )

virtual

Compress a strip of image data.

Parameters

  s | source image data
  o | output buffer
  tile_height | pixel height of the tile we are compressing

Reimplemented from Compressor.

## Finish()

unsigned int JPEGCompressor::Finish | ( | unsigned char * | output | ) |

virtual

Finish the strip based compression and free memory.

Parameters

  output | output buffer

Returns
  size of output generated

Reimplemented from Compressor.

## getHeader()

unsigned char * JPEGCompressor::getHeader | ( |  | ) |

inline virtual

Return a pointer to the header itself.

Reimplemented from Compressor.

## getHeaderSize()

unsigned int JPEGCompressor::getHeaderSize | ( |  | ) |

inline virtual

Return the JPEG header size.

Reimplemented from Compressor.

## getMimeType()

const char * JPEGCompressor::getMimeType | ( |  | ) |

inline virtual

Return the JPEG mime type.

Reimplemented from Compressor.

## getSuffix()

const char * JPEGCompressor::getSuffix | ( |  | ) |

inline virtual

Return the image filename suffix.

Reimplemented from Compressor.

## InitCompression()

void JPEGCompressor::InitCompression | ( | const RawTile & | rawtile,
|  | unsigned int | strip_height )

virtual

Initialise strip based compression.

If we are doing a strip based encoding, we need to first initialise with InitCompression, then compress a single strip at a time using CompressStrip and finally clean up using Finish

Parameters

  rawtile | tile containing the image to be compressed
  strip_height | pixel height of the strip we want to compress

Returns
  header size

Reimplemented from Compressor.

## setQuality()

void JPEGCompressor::setQuality | ( | int | factor | ) |

inline

Set the compression quality.

Parameters

  factor | Quality factor (0-100)

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

- JPEGCompressor.h