1. Lossless rotation and related transforms

Lossless rotation is included in the current release 7 version of the IJG software.

New (08-Feb-2005):
c't Logo An article about the jpegtran lossless transformation functions has been published in the German c't magazine 4/2005 (released 07-Feb-2005), title "Fotoschoner", page 188 ff. The article derives and describes the lossless transformation functions in a clear and understandable form.
My draft of the article (in German) is available here:
Verlustfreie_JPEG_Drehung.doc or Verlustfreie_JPEG_Drehung.pdf .
Note that the draft is quite different from the published version, but the essence is the same.

An Exif Patch has been added to the lossless transformation code to avoid some application problems.
It is part of the release-candidate croppatch to jpegtran (see below).

A new "-perfect" switch has recently been added to the lossless transformation support in jpegtran:

    -perfect       Fail if there is non-transformable edge blocks
Fails with an error if the transformation is not perfect. For example you may want to do
    jpegtran -rot 90 -perfect foo.jpg || djpeg foo.jpg | pnmflip -r90 | cjpeg
to do a perfect rotation if available or an approximated one if not.
Thanks to Bill Allombert (Debian libjpeg maintainer) for the suggestion.
The switch uses a new function previously suggested by me on request for determining whether lossless transformation is perfectly possible for a specified image and transformation.
I strongly recommend that people use this function for determining whether lossless transformation is perfectly possible for a specified image and transformation to avoid unnecessary limitations in their lossless transformation handling!
    /* jtransform_perfect_transform
     *
     * Determine whether lossless transformation is perfectly
     * possible for a specified image and transformation.
     *
     * Inputs:
     *   image_width, image_height: source image dimensions.
     *   MCU_width, MCU_height: pixel dimensions of MCU.
     *   transform: transformation identifier.
     * Parameter sources from initialized jpeg_struct
     * (after reading source header):
     *   image_width = cinfo.image_width
     *   image_height = cinfo.image_height
     *   MCU_width = cinfo.max_h_samp_factor * DCTSIZE
     *   MCU_height = cinfo.max_v_samp_factor * DCTSIZE
     * Result:
     *   TRUE = perfect transformation possible
     *   FALSE = perfect transformation not possible
     *           (may use custom action then)
     */

    GLOBAL(boolean)
    jtransform_perfect_transform(JDIMENSION image_width, JDIMENSION image_height,
                                 int MCU_width, int MCU_height,
                                 JXFORM_CODE transform)
    {
      boolean result = TRUE; /* initialize TRUE */

      switch (transform) {
      case JXFORM_FLIP_H:
      case JXFORM_ROT_270:
        if (image_width % (JDIMENSION) MCU_width)
          result = FALSE;
        break;
      case JXFORM_FLIP_V:
      case JXFORM_ROT_90:
        if (image_height % (JDIMENSION) MCU_height)
          result = FALSE;
        break;
      case JXFORM_TRANSVERSE:
      case JXFORM_ROT_180:
        if (image_width % (JDIMENSION) MCU_width)
          result = FALSE;
        if (image_height % (JDIMENSION) MCU_height)
          result = FALSE;
        break;
      default:
        break;
      }

      return result;
    }
The new switch and function are part of the IJG pre-release version 7 of jpegtran (see below).

2. Lossless crop 'n' drop (cut & paste)

A new feature set currently in development.
Note that the croppatch is release-candidate, while the droppatch is still in experimental state.
The croppatched jpegtran is part of the Debian Linux system.

Resources: