iipsrv 1.2
iipsrv is an advanced high-performance feature-rich image server for web-based streamed viewing and zooming of ultra high-resolution images
Compressor Class Reference

Base class for IIP output images. More...

#include <Compressor.h>

Inheritance diagram for Compressor:
JPEGCompressor PNGCompressor WebPCompressor

Public Member Functions

 Compressor (int compressionLevel)
 Constructor.
 
int getQuality () const
 Get the current quality level.
 
void setResolution (float x, float y, int units)
 Set the physical output resolution.
 
void setICCProfile (const std::string &profile)
 Set the ICC profile.
 
void setXMPMetadata (const std::string &x)
 Set XMP metadata.
 
virtual unsigned int getHeaderSize () const
 Return the image header size.
 
virtual unsigned char * getHeader ()
 Return a pointer to the image header itself.
 
virtual void InitCompression (const RawTile &rawtile, unsigned int strip_height)
 Initialise strip based compression.
 
virtual unsigned int CompressStrip (unsigned char *s, unsigned char *o, unsigned int tile_height)
 Compress a strip of image data.
 
virtual unsigned int Finish (unsigned char *output)
 Finish the strip based compression and free memory.
 
virtual unsigned int Compress (RawTile &t)
 Compress an entire buffer of image data at once in one command.
 
virtual void addXMPMetadata (const std::string &m)
 Add metadata to the image header.
 
virtual const char * getMimeType () const
 Get mime type.
 
virtual const char * getSuffix () const
 Get file suffix.
 
virtual CompressionType getCompressionType () const
 Get compression type.
 

Protected Member Functions

virtual void writeICCProfile ()
 Write ICC profile.
 
virtual void writeXMPMetadata ()
 Write XMP metadata.
 

Protected Attributes

int Q
 Quality or compression level for all image types.
 
unsigned char * header
 Pointer to the header data for the output image.
 
unsigned int header_size
 Size of the header data.
 
float dpi_x
 Physical resolution for X and Y directions.
 
float dpi_y
 
int dpi_units
 Resolution units.
 
std::string icc
 ICC Profile.
 
std::string xmp
 XMP metadata.
 

Detailed Description

Base class for IIP output images.

Constructor & Destructor Documentation

◆ Compressor()

Compressor::Compressor ( int  compressionLevel)
inline

Constructor.

Parameters
compressionLeveldefault compression level for codec

Member Function Documentation

◆ addXMPMetadata()

virtual void Compressor::addXMPMetadata ( const std::string &  m)
inlinevirtual

Add metadata to the image header.

Parameters
mmetadata

◆ Compress()

virtual unsigned int Compressor::Compress ( RawTile t)
inlinevirtual

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

Parameters
ttile of image data
Returns
number of bytes used

Reimplemented in JPEGCompressor, PNGCompressor, and WebPCompressor.

◆ CompressStrip()

virtual unsigned int Compressor::CompressStrip ( unsigned char *  s,
unsigned char *  o,
unsigned int  tile_height 
)
inlinevirtual

Compress a strip of image data.

Parameters
ssource image data
ooutput buffer
tile_heightpixel height of the tile we are compressing
Returns
number of bytes used for strip

Reimplemented in JPEGCompressor, PNGCompressor, and WebPCompressor.

◆ Finish()

virtual unsigned int Compressor::Finish ( unsigned char *  output)
inlinevirtual

Finish the strip based compression and free memory.

Parameters
outputoutput buffer
Returns
size of output generated in bytes

Reimplemented in JPEGCompressor, PNGCompressor, and WebPCompressor.

◆ getCompressionType()

virtual CompressionType Compressor::getCompressionType ( ) const
inlinevirtual

Get compression type.

Returns
compressionType

Reimplemented in JPEGCompressor, PNGCompressor, and WebPCompressor.

◆ getHeader()

virtual unsigned char * Compressor::getHeader ( )
inlinevirtual

Return a pointer to the image header itself.

Returns
binary header blob

Reimplemented in JPEGCompressor, PNGCompressor, and WebPCompressor.

◆ getHeaderSize()

virtual unsigned int Compressor::getHeaderSize ( ) const
inlinevirtual

Return the image header size.

Returns
header size in bytes

Reimplemented in JPEGCompressor, PNGCompressor, and WebPCompressor.

◆ getMimeType()

virtual const char * Compressor::getMimeType ( ) const
inlinevirtual

Get mime type.

Returns
IANA mime type as const char*

Reimplemented in JPEGCompressor, PNGCompressor, and WebPCompressor.

◆ getSuffix()

virtual const char * Compressor::getSuffix ( ) const
inlinevirtual

Get file suffix.

Returns
suffix as const char*

Reimplemented in JPEGCompressor, PNGCompressor, and WebPCompressor.

◆ InitCompression()

virtual void Compressor::InitCompression ( const RawTile rawtile,
unsigned int  strip_height 
)
inlinevirtual

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
rawtiletile containing the image to be compressed
strip_heightpixel height of the strip we want to compress

Reimplemented in JPEGCompressor, PNGCompressor, and WebPCompressor.

◆ setICCProfile()

void Compressor::setICCProfile ( const std::string &  profile)
inline

Set the ICC profile.

Parameters
profileICC profile string

References icc.

◆ setXMPMetadata()

void Compressor::setXMPMetadata ( const std::string &  x)
inline

Set XMP metadata.

Parameters
xXMP metadata string

References xmp.

Member Data Documentation

◆ dpi_units

int Compressor::dpi_units
protected

Resolution units.

Units can be 0 for unknown, 1 for dots/inch or 2 for dots/cm

Referenced by setResolution().


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