Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Lossless auto-rotation of JPEGs

4 views
Skip to first unread message

Ilya Zakharevich

unread,
Feb 22, 2009, 7:14:13 PM2/22/09
to
I looked for the least-hassle solution for lossless auto-rotation of
JPEG images. I wrote my own script, and tried what others allow.

IMO, the winner is jhead (from hobbes; very small; requires jpegtrans
from jpeg6b package - also on hobbes).

Weaknesses:
a) Can't do 4 operations in one step
(copy/losslessly-rotate-if-needed/correct-rotation-flag-in-header/set-time)
b) Does not support wildcards.

Still, it is much more convenient than the alternatives I tried.

So: what I do now:

a) Manually copy JPG files to destination directory.

b) Run a for-loop over a 4os2 alias which does 3 remaining operations.
As in

(for %f in (150MSDCF\*.jpg 151MSDCF\*.jpg) do jpeg_arotate "%f" ) |& tee 00arot

Here jpeg_arotate is aliased as
jpeg_arotate (jhead -autorot %& && jhead -ft -norot %&)

Hope this helps,
Ilya

Ilya Zakharevich

unread,
Jul 29, 2009, 5:06:00 PM7/29/09
to
On 2009-02-23, Ilya Zakharevich <nospam...@ilyaz.org> wrote:
> I looked for the least-hassle solution for lossless auto-rotation of
> JPEG images. I wrote my own script, and tried what others allow.
>
> IMO, the winner is jhead (from hobbes; very small; requires jpegtrans
> from jpeg6b package - also on hobbes).

> (for %f in (150MSDCF\*.jpg 151MSDCF\*.jpg) do jpeg_arotate "%f" ) |& tee 00arot


>
> Here jpeg_arotate is aliased as
> jpeg_arotate (jhead -autorot %& && jhead -ft -norot %&)

Yesterday I needed to rotate images manually (this particular camera
had no gravity sensor). I did the same with alias targets

(jhead -cmd "jpegtran -rotate 90 &i > &o" -ft %&)
(jhead -cmd "jpegtran -rotate 270 &i > &o" -ft %&)

90 for clockwise, 270 for counter-clockwise rotations. (I did not do
any comparison with other software this time. I did not use -norot
flag, since there was no rotation-tag to start with...)

Hope this helps,
Ilya

0 new messages