[Nottingham] Tweaking the orientation flag in a jpeg

Camilo Mesias camilo at mesias.co.uk
Wed Sep 1 18:54:53 UTC 2010


Hi,

exiftool is worth a look if you don't want to have to figure out the offsets,

$ exiftool -n -Orientation=1 ~/p1050043.jpg

$ exiftool -Orientation ~/p1050043.jpg
Orientation                     : Horizontal (normal)

It has a good manpage and online docs.

If you have to write a program to tweak one byte in a file it might be
worth looking at mmap(), there are examples online and there are fewer
things to go wrong than if you try to read the whole file into memory.
So a well written program using  mmap() might be smaller than one that
uses traditional file IO.

-Cam



More information about the Nottingham mailing list