LosslessJpegTransform Method (String, String, JpegTransformType) |
Namespace: Atalasoft.Imaging.ImageProcessing
Exception | Condition |
---|---|
Thrown is the current license is not DotImage Photo Pro, or DotImage Document Imaging. | |
Thrown is the current license is not DotImage Photo Pro, or DotImage Document Imaging. |
This can be used to perform one of a set of simple transformations without decompressing the JPEG data. By not decompressing, you don't have to re-compress, thus avoiding adding additional JPG artifacts to the output image.
This works by rearranging the compressed data (DCT coefficients), without ever fully decoding the image. Therefore, its transformations are lossless: there is no image degradation at all, which is not the case if you were to read the image to RGB, transform, and save again as JPG.
The transpose transformation has no restrictions regarding image dimensions. The other transformations operate rather oddly if the image dimensions are not a multiple of the iMCU size (usually 8 or 16 pixels, though sometimes 32 or 48), because they can only transform complete blocks of DCT coefficient data in the desired way.
The default behavior is to discard these "extra" blocks. This prevents ugly strips of unmodified data along one edge. So, strictly speaking, these transformations are not lossless for all images: they are lossless only for images with dimensions that are multiples of 8 or 16. You can override this discarding the extra blocks, though it is not recommended.