Example #1
0
 /// <summary>
 /// The maximum size of the buffer (in bytes) required to hold a JPEG image with
 /// the given parameters.  The number of bytes returned by this function is
 /// larger than the size of the uncompressed source image.  The reason for this
 /// is that the JPEG format uses 16-bit coefficients, and it is thus possible
 /// for a very high-quality JPEG image with very high-frequency content to
 /// expand rather than compress when converted to the JPEG format.  Such images
 /// represent a very rare corner case, but since there is no way to predict the
 /// size of a JPEG image prior to compression, the corner case has to be handled.
 /// </summary>
 /// <param name="width">Width (in pixels) of the image.</param>
 /// <param name="height">Height (in pixels) of the image.</param>
 /// <param name="subSamp">
 /// The level of chrominance subsampling to be used when
 /// generating the JPEG image(see <see cref="TJSubsamplingOption"/> "Chrominance subsampling options".)
 /// </param>
 /// <returns>
 /// The maximum size of the buffer (in bytes) required to hold the image,
 /// or -1 if the arguments are out of bounds.
 /// </returns>
 public int GetBufferSize(int width, int height, TJSubsamplingOption subSamp)
 {
     return((int)TurboJpegImport.TjBufSize(width, height, (int)subSamp));
 }