pub unsafe extern "C" fn tj3JPEGBufSize(
    width: c_int,
    height: c_int,
    jpegSubsamp: c_int
) -> size_t
Expand description

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, so it is possible for a very high-quality source image with very high-frequency content to expand rather than compress when converted to the JPEG format. Such images represent very rare corner cases, but since there is no way to predict the size of a JPEG image prior to compression, the corner cases have to be handled.

@param width width (in pixels) of the image

@param height height (in pixels) of the image

@param jpegSubsamp the level of chrominance subsampling to be used when generating the JPEG image (see @ref TJSAMP “Chrominance subsampling options”.) #TJSAMP_UNKNOWN is treated like #TJSAMP_444, since a buffer large enough to hold a JPEG image with no subsampling should also be large enough to hold a JPEG image with an arbitrary level of subsampling. Note that lossless JPEG images always use #TJSAMP_444.

@return the maximum size of the buffer (in bytes) required to hold the image, or 0 if the arguments are out of bounds.