## JPEG Transcoding

The commands in this group perform a variety of operations on JPEG images by directly transcoding the compressed data (ie, without decompressing).

- Lossless geometric transformations
- Process non-image data
- Commands

### Lossless geometric transformations

Geometric tranformations of images are usually performed in the following steps:

1. The original image is decompressed to a pixel map
2. The pixel map is transformed
3. The transformed pixel map is recompressed to the original format

While this method is OK with images in lossless compression formats such as TIFF or PNG, there is a problem with lossy formats such as JPEG: recompression causes loss of quality.

The commands in this group perform simple geometric transformations on JPEG images losslessly. This is done by rearranging the compressed data, without decompressing and recompressing.

The supported lossless transformations are:

- Rotate 90
- Rotate 180
- Rotate 270
- Flip horizontally
- Flip vertically
- Mirror across upper-left to lower-right axis
- Mirror across upper-right to lower-left axis

The "Mirror across upper-left to lower-right axis" transformation has no restrictions. The other transformations may be affected if the image dimensions are not a multiple of the MCU size (8 pixels for grayscale, 16 pixels for color images). Because only complete blocks of data can be transformed, some transformations may leave untransformed blocks at the edges.

The following table summarizes the effects of non-MCU-multiple image dimensions for each available transformation. A * indicates that the specific transformation will cause "edge effects".

Transformation | (width % MCU) # 0 | (height % MCU) # 0
Rotate 90 |  | *
Rotate 180 | * | *
Rotate 270 | * |
Flip horizontally | * |
Flip vertically |  | *
Mirror across upper-left to lower-right axis |  |
Mirror across upper-right to lower-left axis | * | *

Available options for handling this issue are:

- Ignore untransformed blocks at the edges.
- Trim images with odd dimensions.
- Transform only even-size images.

### Non-image data processing

JPEG images may contain various kinds of non-image data:

- Comments
- EXIF data including an embedded thumbnail
- IPTC data stored by PhotoShop or other software
- Embedded thumbnails

Sometimes it is necessary to strip some or all of that data from JPEG images. For example, when preparing images for web delivery deleting non-image data can reduce the file sizes significantly.

The following operations can be performed on the no-image data by transcoding:

- Copy all non-image data
- Copy comments only
- Delete non-image data

### Commands

QPx_TranscodeJPEGFile | Transcodes a JPEG file
QPx_TranscodeJPEGBLOB | Transcodes a JPEG BLOB

QPix © Escape
Generated by QDoc 2.8 on Wed, Feb 17, 2010 17:45:23