TerraLib 4.1
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:
srcBufferaddress of the image in memory
widthwidth of image in pixels
heightheight of image in pixels
bppnumber of bytes per pixel (1 or 3)
dstBufferpointer 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
lenreturns the size of the compressed data. Initially this parameter should contain the size of the pre-allocated buffer
qualityimage 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:
bufferaddress of the buffer that contains the image in memory
widthwidth of image in pixels
heightheight of image in pixels
bppnumber of bytes per pixel (1 or 3)
fileNamename of the compressed file
qualityimage 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:
srcBuffermemory address containing jpeg compressed data
sizesize in bytes of the jpeg compressed data
dstBufferpointer to a buffer to return the decompressed data. The function assumes that it was allocated with enough space to hold the decompressed data
widthreturn the number of columns of the data
heightreturn the number of lines of the data
bppreturn 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:
fileNamename of the file
dstBufferpointer to a buffer to return the decompressed data. The function assumes that it was allocated with enough space to hold the decompressed data
widthreturns the number of columns of the data
heightreturns the number of lines of the data
nChannelsreturns 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:
fileNamename of the file
widthreturn the number of columns of the data
heightreturn the number of lines of the data
nChannelsreturn 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