LEADTOOLS Image File Support (Leadtools.Codecs assembly) Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.3.29
StartCompress(Int32,Int32,Int32,RasterByteOrder,RasterViewPerspective,Int32,IntPtr,Int32,CodecsCompression,CodecsCompressDataCallback) Method
See Also 
Leadtools.Codecs Namespace > RasterCodecs Class > StartCompress Method : StartCompress(Int32,Int32,Int32,RasterByteOrder,RasterViewPerspective,Int32,IntPtr,Int32,CodecsCompression,CodecsCompressDataCallback) Method



width
The image being compressed width in pixels.
height
The image being compressed height in pixels.
bitsPerPixel
The image being compressed bits/pixel value.
order
The image being compressed byte order.
viewPerspective
The image being compressed view perspective value.
inputDataLength
Size in bytes of the input image data.
outputData
Pointer to unmanaged memory buffer will be filled with the compressed data.
outputDataLength
Size of outputData in bytes.
compression

Type of compression to use. Valid values are:

Value Meaning
CodecsCompression.Cmp LEAD CMP compression format
CodecsCompression.Jpeg444 JPEG File Interchange Format using YUV 4:4:4 color spacing
CodecsCompression.Jpeg422 JPEG File Interchange Format using YUV 4:2:2 color spacing
CodecsCompression.Jpeg411 JPEG File Interchange Format using YUV 4:1:1 color spacing
CodecsCompression.TifJpeg444 JPEG JTIF using YUV 4:4:4 color spacing
CodecsCompression.TifJpeg422 JPEG JTIF using YUV 4:2:2 color spacing
CodecsCompression.TifJpeg411 JPEG JTIF using YUV 4:1:1 color spacing
CodecsCompression.Lead0 LEAD 1 bit, lossless compression
CodecsCompression.Lead1 LEAD 1 bit, excellent compression
CodecsCompression.TiffCcitt TIFF CCITT
CodecsCompression.TiffCcittG3Fax1Dim CCITT Group 3 one dimensional
CodecsCompression.TiffCcittG3Fax2Dim CCITT Group 3 two dimensional
CodecsCompression.TiffCcittG4Fax CCITT Group 4 two dimensional

callback
The callback method responsible for writing or handling the compressed data.
width
The image being compressed width in pixels.
height
The image being compressed height in pixels.
bitsPerPixel
The image being compressed bits/pixel value.
order
The image being compressed byte order.
viewPerspective
The image being compressed view perspective value.
inputDataLength
Size in bytes of the input image data.
outputData
Pointer to unmanaged memory buffer will be filled with the compressed data.
outputDataLength
Size of outputData in bytes.
compression

Type of compression to use. Valid values are:

Value Meaning
CodecsCompression.Cmp LEAD CMP compression format
CodecsCompression.Jpeg444 JPEG File Interchange Format using YUV 4:4:4 color spacing
CodecsCompression.Jpeg422 JPEG File Interchange Format using YUV 4:2:2 color spacing
CodecsCompression.Jpeg411 JPEG File Interchange Format using YUV 4:1:1 color spacing
CodecsCompression.TifJpeg444 JPEG JTIF using YUV 4:4:4 color spacing
CodecsCompression.TifJpeg422 JPEG JTIF using YUV 4:2:2 color spacing
CodecsCompression.TifJpeg411 JPEG JTIF using YUV 4:1:1 color spacing
CodecsCompression.Lead0 LEAD 1 bit, lossless compression
CodecsCompression.Lead1 LEAD 1 bit, excellent compression
CodecsCompression.TiffCcitt TIFF CCITT
CodecsCompression.TiffCcittG3Fax1Dim CCITT Group 3 one dimensional
CodecsCompression.TiffCcittG3Fax2Dim CCITT Group 3 two dimensional
CodecsCompression.TiffCcittG4Fax CCITT Group 4 two dimensional

callback
The callback method responsible for writing or handling the compressed data.
Initializes the unmanaged memory buffered compression engine.

Syntax

Visual Basic (Declaration) 
Overloads Public Sub StartCompress( _
   ByVal width As Integer, _
   ByVal height As Integer, _
   ByVal bitsPerPixel As Integer, _
   ByVal order As RasterByteOrder, _
   ByVal viewPerspective As RasterViewPerspective, _
   ByVal inputDataLength As Integer, _
   ByVal outputData As IntPtr, _
   ByVal outputDataLength As Integer, _
   ByVal compression As CodecsCompression, _
   ByVal callback As CodecsCompressDataCallback _
) 
Visual Basic (Usage)Copy Code
Dim instance As RasterCodecs
Dim width As Integer
Dim height As Integer
Dim bitsPerPixel As Integer
Dim order As RasterByteOrder
Dim viewPerspective As RasterViewPerspective
Dim inputDataLength As Integer
Dim outputData As IntPtr
Dim outputDataLength As Integer
Dim compression As CodecsCompression
Dim callback As CodecsCompressDataCallback
 
instance.StartCompress(width, height, bitsPerPixel, order, viewPerspective, inputDataLength, outputData, outputDataLength, compression, callback)

Parameters

width
The image being compressed width in pixels.
height
The image being compressed height in pixels.
bitsPerPixel
The image being compressed bits/pixel value.
order
The image being compressed byte order.
viewPerspective
The image being compressed view perspective value.
inputDataLength
Size in bytes of the input image data.
outputData
Pointer to unmanaged memory buffer will be filled with the compressed data.
outputDataLength
Size of outputData in bytes.
compression

Type of compression to use. Valid values are:

Value Meaning
CodecsCompression.Cmp LEAD CMP compression format
CodecsCompression.Jpeg444 JPEG File Interchange Format using YUV 4:4:4 color spacing
CodecsCompression.Jpeg422 JPEG File Interchange Format using YUV 4:2:2 color spacing
CodecsCompression.Jpeg411 JPEG File Interchange Format using YUV 4:1:1 color spacing
CodecsCompression.TifJpeg444 JPEG JTIF using YUV 4:4:4 color spacing
CodecsCompression.TifJpeg422 JPEG JTIF using YUV 4:2:2 color spacing
CodecsCompression.TifJpeg411 JPEG JTIF using YUV 4:1:1 color spacing
CodecsCompression.Lead0 LEAD 1 bit, lossless compression
CodecsCompression.Lead1 LEAD 1 bit, excellent compression
CodecsCompression.TiffCcitt TIFF CCITT
CodecsCompression.TiffCcittG3Fax1Dim CCITT Group 3 one dimensional
CodecsCompression.TiffCcittG3Fax2Dim CCITT Group 3 two dimensional
CodecsCompression.TiffCcittG4Fax CCITT Group 4 two dimensional

callback
The callback method responsible for writing or handling the compressed data.

Example

Remarks

This method initializes the buffered compression engine. The compression is then carried out using the Compress(Byte[],Int32) method. It is ended by the StopCompress method.

If order is set to to RasterByteOrder.Bgr and viewPerspective is RasterViewPerspective.TopLeft then the data that you put into the input buffer must be RasterByteOrder.Bgr and loaded from top left.

The compression process starts after the first call to Compress(Byte[],Int32). The callback is called when the output buffer is filled with compressed data or after completing the compression process. callback is responsible for emptying the output buffer - storing it, sending it, or doing other processing.

The following is a flow chart that shows the relationship of these methods:

Call StopCompress to end the compression process started by a call to StartCompress(Int32,Int32,Int32,RasterByteOrder,RasterViewPerspective,Int32,Byte[],Int32,Int32,CodecsCompression,CodecsCompressDataCallback).

The quality factor of the compressed data is obtained as follows:

Format Quality factor used
CodecsCompression.Cmp CodecsJpegSaveOptions.QualityFactor and CodecsJpegSaveOptions.CmpQualityFactorPredefined
CodecsCompression.Jpeg444 CodecsJpegSaveOptions.QualityFactor
CodecsCompression.Jpeg422 CodecsJpegSaveOptions.QualityFactor
CodecsCompression.Jpeg411 CodecsJpegSaveOptions.QualityFactor
CodecsCompression.TifJpeg444 CodecsJpegSaveOptions.QualityFactor
CodecsCompression.TifJpeg422 CodecsJpegSaveOptions.QualityFactor
CodecsCompression.TifJpeg411 CodecsJpegSaveOptions.QualityFactor
CodecsCompression.Lead0 Not used
CodecsCompression.Lead1 Not used
CodecsCompression.TiffCcitt Not used
CodecsCompression.TiffCcittG3Fax1Dim Not used
CodecsCompression.TiffCcittG3Fax2Dim Not used
CodecsCompression.TiffCcittG4Fax Not used

This method does not support signed data images.

Requirements

Target Platforms: Silverlight, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7, MAC OS/X (Intel Only)

See Also