| TerraLib 4.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Examples

- Namespace List
- Namespace Members

Functions
Jpeg Namespace Reference

A wrapper around the libjpeg provinding higher level C++ functions. More...

## Functions

bool | ReadFileParams (const string &fileName, int &width, int &height, int &nChannels)
bool | DecompressFile (const string &fileName, unsigned char *dstBuffer, int &width, int &height, int &nChannels)
bool | DecompressBuffer (unsigned char *srcBuffer, int size, unsigned char *dstBuffer, int &width, int &height, int &bpp)
bool | CompressToFile (unsigned char *buffer, int width, int height, int bpp, const string &fileName, int quality=75)
bool | CompressToBuffer (unsigned char *srcBuffer, int width, int height, int bpp, unsigned char *dstBuffer, int &len, int quality)
TL_DLL bool | ReadFileParams (const std::string &fileName, int &width, int &height, int &nChannels)
TL_DLL bool | DecompressFile (const std::string &fileName, unsigned char *dstBuffer, int &width, int &height, int &nChannels)
TL_DLL bool | CompressToFile (unsigned char *buffer, int width, int height, int bpp, const std::string &fileName, int quality=75)

## Detailed Description

A wrapper around the libjpeg provinding higher level C++ functions.

## Function Documentation

TL_DLL bool Jpeg::CompressToBuffer | ( | unsigned char * | srcBuffer,
|  | int | width,
|  | int | height,
|  | int | bpp,
|  | unsigned char * | dstBuffer,
|  | int & | len,
|  | int | quality = `75`
| ) |  |

Compresses an image buffer to a JPEG image in memory

Parameters:

  srcBuffer | address of the image in memory
  width | width of image in pixels
  height | height of image in pixels
  bpp | number of bytes per pixel (1 or 3)
  dstBuffer | pointer to a buffer to buffer to return the compressed data. The function assumes that it was allocated with enough space to hold the compressed data
  len | returns the size of the compressed data. Initially this parameter should contain the size of the pre-allocated buffer
  quality | image quality as a percentage

Returns:
  true or false whether the compressing was successfull or not

bool Jpeg::CompressToFile | ( | unsigned char * | buffer,
|  | int | width,
|  | int | height,
|  | int | bpp,
|  | const string & | fileName,
|  | int | quality = `75`
| ) |  |

TL_DLL bool Jpeg::CompressToFile | ( | unsigned char * | buffer,
|  | int | width,
|  | int | height,
|  | int | bpp,
|  | const std::string & | fileName,
|  | int | quality = `75`
| ) |  |

Compresses an image buffer to a JPEG image file

Parameters:

  buffer | address of the buffer that contains the image in memory
  width | width of image in pixels
  height | height of image in pixels
  bpp | number of bytes per pixel (1 or 3)
  fileName | name of the compressed file
  quality | image quality as a percentage value

Returns:
  true or false whether the compressing was successfull or not

TL_DLL bool Jpeg::DecompressBuffer | ( | unsigned char * | srcBuffer,
|  | int | size,
|  | unsigned char * | dstBuffer,
|  | int & | width,
|  | int & | height,
|  | int & | bpp
| ) |  |

Decompresses a JPEG image buffer to a buffer in memory

Parameters:

  srcBuffer | memory address containing jpeg compressed data
  size | size in bytes of the jpeg compressed data
  dstBuffer | pointer to a buffer to return the decompressed data. The function assumes that it was allocated with enough space to hold the decompressed data
  width | return the number of columns of the data
  height | return the number of lines of the data
  bpp | return the number of bytes per pixel

Returns:
  true or false whether the decompressing was successfull or not

TL_DLL bool Jpeg::DecompressFile | ( | const std::string & | fileName,
|  | unsigned char * | dstBuffer,
|  | int & | width,
|  | int & | height,
|  | int & | nChannels
| ) |  |

Reads and decompresses a JPEG image file to a buffer in memory

Parameters:

  fileName | name of the file
  dstBuffer | pointer to a buffer to return the decompressed data. The function assumes that it was allocated with enough space to hold the decompressed data
  width | returns the number of columns of the data
  height | returns the number of lines of the data
  nChannels | returns the number of bands, or channels, of the data

Returns:
  true or false whether the decompressing was successfull or not

bool Jpeg::DecompressFile | ( | const string & | fileName,
|  | unsigned char * | dstBuffer,
|  | int & | width,
|  | int & | height,
|  | int & | nChannels
| ) |  |

bool Jpeg::ReadFileParams | ( | const string & | fileName,
|  | int & | width,
|  | int & | height,
|  | int & | nChannels
| ) |  |

TL_DLL bool Jpeg::ReadFileParams | ( | const std::string & | fileName,
|  | int & | width,
|  | int & | height,
|  | int & | nChannels
| ) |  |

Reads the main informations about a JPEG image file

Parameters:

  fileName | name of the file
  width | return the number of columns of the data
  height | return the number of lines of the data
  nChannels | return the number of bands, or channels, of the data

Returns:
  true or false whether the raster was imported successfully

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines