Jhead est un programme en ligne de commande pour manipuler les méta-données des fichiers JPEG/Exif que produisent la plupart des appareils photo numériques.
Utilisateurs Windows / Mac : Jhead n'a pas d'interface utilisateur graphique. Cliquer dessus avec la souris sous Windows ou Mac OS-X ne fera rien, il faut l'utiliser dans l'invite de commande.
Fonctionnalités du programme Jhead v3.04 :
Les fichiers provenant de presque tous les appareils photo numériques sont des fichiers Jpeg avec des données Exif.
Les fichiers Exif sont pour la plupart des fichiers Jpeg, mais contiennent des sections de données supplémentaires avec les paramètres de l'appareil photo, ainsi qu'une vignette d'aperçu dans l'en-tête Exif.
De nombreux navigateurs d'images utilisent cette vignette lors de la navigation, tandis que d'autres navigateurs créent leurs propres vignettes en fonction de l'image dans son ensemble.
Comme je m'intéresse à la photographie, je suis toujours curieux de savoir quels paramètres mon appareil photo numérique entièrement automatique a finalement utilisé.
En 1999, lorsque j'ai créé jhead, je ne trouvais pas de programme qui affiche les paramètres, ni qui pourrait être compilé dans un simple exécutable.
Depuis, j'ai ajouté de nombreuses autres fonctionnalités à jhead, dont beaucoup sont le résultat de suggestions ou de contributions de code.
Bien qu'il existe aujourd'hui de nombreux programmes capables de manipuler les en-têtes Exif, jhead reste l'outil le plus simple et le plus efficace, surtout pour des tâches automatisées ou scriptées.
USER@MACHINE:~$ sudo apt install {jhead,}
USER@MACHINE:~$ jhead -te "originals\&i" *.jpg
transférera l'en-tête Exif de chaque fichier .jpg du même nom dans le répertoire d'origine.
USER@MACHINE:~$ jhead -n%Y%m%d-%H%M%S *.jpg
Renommera les fichiers correspondant à *.jpg selon le format AAAAMMJJ-HHMMSS.
USER@MACHINE:~$ jhead -n%Y%%m%d-%H%%M%%S *.jpg
USER@MACHINE:~$ jhead -ta+1:00 *.jpg
USER@MACHINE:~$ jhead -ta-0:00:23 *.jpg
USER@MACHINE:~$ jhead -ta+49 *.jpg
USER@MACHINE:~$ jhead -da2005:03:01-2004:03:01
USER@MACHINE:~$ jhead -da2005:05:29/11:21-2002:01:01
aaaa:mm:dd-hh:mm:ss
aaaa:mm:dd, aaaa:mm
, or
aaaa
I implemented this option because I kept getting asked about having such an option. I don't consider the built in thumbnails to be all that useful - too low res. However, now you can see for yourself. I always generate my thumbnails using ImageMagick (see end of this page). Like the '-te' option, this feature has the 'relative path' option for specifying the thumbnail name. Whenever the <name> contains the characters '&i', jhead will substitute the original filename for this name. This allows creating a 'relative name' when doing a whole batch of files. For example, the incantation:
jhead -st "thumbnails\&i" *.jpg
would create a thumbnail for each .jpg file in the thumbnails directory by the same name, (provided that the thumbnails directory exists, of course). Both Win32 and most UNIX shells treat the '&' character in a special way, so you have to put quotes around that command line option for the '&' to even be passed to the program.
If a '-' is specified for the output file, the thumbnail is sent to stdout. (UNIX build only) -rt <name> Replace thumbnails from the Exif header. This only works if the Exif header already contains an Exif header a thumbnail. -rgt[size] Regenerate Exif thumbnail. 'size' specifies maximum height or width of thumbnail. I added this option because I had a lot of images that I had rotated with various tools that don't update the Exif header. But newer image browsers such as XnView make use of the Exif thumbnail, and so the thumbnails would be different from the image itself. Note that the rotation tag also needed to be cleared (-norot option). Typically, only images that are shot in portrait orientation are afflicted with this. You can use the -orp option to tell jhead to only operate on images that are upright.
This option relies on 'mogrify' program (from ImageMagick) to regenerate the thumbnail. Linux users often already have this tool pre-installed. Windows users have to go and download it. This option only works if the image already contains a thumbnail. Rotation tag manipulation -autorot Using the 'Orientation' tag of the Exif header, rotate the image so that it is upright. The program 'jpegtran' is used to perform the rotation. This program is present in most Linux distributions. For windows, you need to get a copy of it. After rotation, the orientation tag of the Exif header is set to '1' (normal orientation). The Exif thumbnail is also rotated. Other fields of the Exif header, including dimensions are untouched, but the JPEG height/width are adjusted. This feature is especially useful with newer digital cameras, which set the orientation field in the Exif header automatically using a built in orientation sensor in the camera. -norot Clears the Exif header rotation tag without altering the image. You may find that your images have rotation tags in them from your camera, but you already rotated them with some lossless tool without clearing the rotation tag. Now your friendly browser rotates the images on you again because the image rotation tag still indicates the image should be rotated. Use this option to fix this problem. You may also want to regenerate the thumbnail using the -rgt option. Output verbosity control -h Displays summary of command line options. -v Makes the program even more verbose than it already is. Like DOS programs, and unlike UNIX programs, Jhead gives feedback as to what it is doing, even when nothing goes wrong. Windows user that I am, when something doesn't give me feedback for 20 seconds, I assume its crashed. -q Makes the program not spit out messages on success - more like the “Silence is golden” Unix way. its crashed. -V Print version info and compilation date. -exifmap Show a map of the bytes in the Exif header. Useful when analyzing strange Exif headers, not of much use to non software developers. -se Suppress error messages relating to corrupt Exif header structure. -c Concise output. This causes picture info to be summarized on one line instead of several. Useful for grep-ing through images, as well as importing into spread sheets (data is space delimited with quotes as text qualifier). File matching and selection -model <model> Restricts processing of files to those whose camera model, as indicated by the Exif image information, contains the substring specified in the argument after '-model'. For example, the following command will list only images that are from an S100 camera:
jhead -model S100 *.jpg
I use this option to restrict my JPEG re-compressing to those images that came from my Cannon S100 camera, (see the -cmd option). -quality <nn> Restricts processing of files to those whose estimated quality factor is equal to or higher than the specified number nn. -exonly Skip all files that don't have an Exif header. This skips all files that did not come directly from the digital camera, as most photo editing software does not preserve the Exif header when saving pictures. -cmd<command> Executes the specified command on each Jpeg file to be processed.
The Exif section of each file is read before running the command, and re-inserted after the command finishes.
This is useful for using Jhead's file globbing capability for processing a whole directory tree of files.
It's also useful for restoring the exif header after operations that wipe out the Exif metadata. Most programs today however will keep the Exif metadata intact, so this is less important than it used to be. -orp, -orl Operate only on images with portrait (-orp) or landscape (-orl) aspect ratio. Please note that this is solely based on jpeg width and height values. Some browsers may auto rotate the image on displaying it based on the Exif orientation tag, so that images shot in portrait mode are displayed as portrait. However, the image itself may not be stored in portrait orientation. The -autorot and -norot options are useful for dealing with rotation issues. -r The recursive feature of version 1.0 never worked to my satisfaction, and I replaced it with my recursive file globbing code in the Windows version. See below. Bugs and Shortcomings
After Jhead runs a program to rotate or resize an image, the image dimensions and thumbnail in the Exif header are not adjusted.
Modifying of Exif header data is very limited, as Jhead internally only has a read only implementation of the file system contained in the Exif header. For the most part, Exif can only modify pre-existing fixed-length fields in the header.
Most Canon digital SLR cameras fail to adjust the effective sensor resolution when shooting at less than full resolution, causing Jhead to incorrectly miscalculate the sensor width and 35mm equivalent focal length. The same can result from resizing photos with Photoshop, which will manipulate parts of the Exif header. This is often reported as a bug in Jhead, but Jhead can't do much about incorrect data.
Name globbing and recursive directories under Windows
Name globbing means matching wildcard patterns to actual file names. If you know what this term means, you are probably annoyed at how programs on Windows typically handle this. The Win32 version of this program goes beyond the pattern matching that Windows provides, and allows you to specify fancy UNIX-like patterns such as:
jhead c:\pix\199*\*\*.jpg
This program goes one step beyond beyond that in that "**" as a path component means any level of subdirectories. The invocation
jhead c:\**\*.jpg
will find ALL Jpegs files on the c: drive, including those in the root directory. The ** only works if it is the only part of that path component. For example, the path 'c:\a**\*.jpg' will not recurse. The '**' recursive expansion is ONLY supported on the Windows version. The code is in the module 'myglob.c', if you want to reuse it (I certainly intend to reuse that code for other applications). Under UNIX, the shell's wildcard expansion is pretty decent already, and dealing with the convoluted nature of some UNIX file layouts, doing better would have been much more of a challenge.
Programs I use with Jhead ImageMagick
I use the MOGIRIFY command from ImageMagick to do batch conversions and re-compresses of images. If you use Linux, you probably already have ImageMagick on your system (just type 'mogrify' at the command prompt to see if you have it). For Windows users, you have to download it from: http://www.imagemagick.org
Image Magick is one of those programs that preserves comment and Exif headers, although older versions do not.
JPEGTRAN
If you use Linux you probably also already have this program. For windows, it's hard to find a pre-built binary on the web. The Independent JPEG Group's website only has the source code.
There's a fancier version, with pre-built Windows binaries and a lossless cropping feature added at: http://sylvana.net/jpegcrop.
XnView
XnView is an excellent, small, fast, and free graphical image browser. It makes use of jpeg thumbnails for the thumbnail view. On account of Xnview, I added options to fix or regenerate the thumbnails to jhead, so that I could regenerate the thumbnails for images where the thumbnail had gotten out of sync with the image. Mac and Linux versions of XnView are also available.
wrjpgcom / rdjpgcom
You can use these programs to write and extract COM markers from JPEG images respectively. Although I always use my jhead program for this feature, the wrjpgcom and rdjpgcom programs are extremely simple and very suitable for use with shell scripts to process lots of images. These programs are part of most Linux distributions as part of the libjpg package (along with jpegtran)
Exemple de sortie jhead :
...@...:~$ jhead 0805-153933.jpg File name : 0805-153933.jpg File size : 463023 bytes File date : 2001:08:12 21:02:04 Camera make : Canon Camera model : Canon PowerShot S100 Date/Time : 2001:08:05 15:39:33 Resolution : 1600 x 1200 Flash used : No Focal length : 5.4mm (35mm equivalent: 36mm) CCD Width : 5.23mm Exposure time: 0.100 s (1/10) Aperture : f/2.8 Focus Dist. : 1.18m Metering Mode: center weight Jpeg process : Baseline
Le programme dispose de nombreuses options en ligne de commande pour manipuler les fichiers Exif, telles que des options pour manipuler la date dans l'en-tête, renommer les fichiers image ou coordonner l'exécution de Jpegtran et Mogrify pour manipuler des arborescences entières de répertoires d'images.
Basé sur « Jhead is a command line driven program for manipulating the non-image parts of Exif flavour JPEG files that most digital cameras produce » par sentex.ca/~mwandel.