Just for information, this is how I got JPEGTran working for lossless image transformations. This is an actual code hack, not recommended for anything sensitive (production servers etc etc). Don't blame me for destroying anything either, I'm just showing you how I've quickly knocked something up as a guide.
Make sure to install and enable keeporiginal Gallery 3 module before doing this, its useful if the rotation goes wrong (or you mess up the code).
Install jpegtran (you're on your own here). Available in libjpeg-progs package on debian systems.
Modify file: gallery/modules/gallery/controllers/quick.php. Replace the following sections:
Line 39:
gallery_graphics::rotate($item->file_path(), $item->file_path(),
array("degrees" => $degrees));
Replace with:
if($error = exec('jpegtran -rot '.escapeshellarg($degrees).' -trim -outfile '.escapeshellarg($item->file_path()).' -copy all '.escapeshellarg($item->file_path())))
{
$this->errors[] = $error;
return FALSE;
}
Line 29:
case "ccw":
$degrees = -90;
break;
Replace with:
case "ccw":
$degrees = 270;
break;
Have fun 