[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Edlug Archive Jan 2004 ]

Re: [edlug] digital photo database



Hi,

On Fri, 2004-01-16 at 20:16, John McAulay wrote:
> If you are rotating through 90 or 180 (or obviously 270 which is just 
> -90) degrees there should be no loss

In most cases there *is* loss there if you're starting off with a lossy
file format such as JPEG in the first place.  Most rotation methods will
uncompress the image, rotate it, then recompress, and it's the
uncompression and recompression that causes loss, not the rotation
itself.

The lossless rotation in gthumb and jpegtran is a special case: it does
not rotate the image, rather it rotates the order individual DCT
transform blocks of the JPEG, and swaps the X and Y frequencies in each
block.  It works directly on the *compressed* data, not the uncompressed
data, and just reorders that compressed data --- nothing at all is
discarded.  So it truly is lossless.

The only gotcha is that this makes it vulnerable to one particular
property of JPEG compression --- since it works directly on entire JPEG
blocks (usually 8x8 pixels), rotation is only reliable if your image is
a whole multiple of 8 pixels in each direction.  For images directly
from a camera, that's usually not a problem.

btw, I use "jhead -autorot" on all the images that come from my 10D. 
Like increasing numbers of digital cameras, it has an orientation sensor
which records the physical orientation of the camera when an image is
taken.  "jhead -autorot" looks up the appropriate EXIF tag in the JPEG
and uses that to decide which images need a lossless 90 or 270 degree
rotation via jpegtran.  It works reliably enough for me that I actually
discard the original JPEGs and preserve only the -autorot'ated versions.

If your camera doesn't support orientation EXIF tags, gthumb2's lossless
rotate can work in a batch on all selected images (just click on "rotate
all images), so it's pretty easy to select the portrait pics from the
thumbnails and rotate all the ones that need it at once.

Cheers,
 Stephen

-
----------------------------------------------------------------------
You can find the EdLUG mailing list FAQ list at:
http://www.edlug.org.uk/list_faq.html



This archive is kept by wibble@morpheux.org.DONTSPAMME
homepage