Automatic rotation, renaming and resizing of pictures
Sometimes you need to share a number of raw pictures over the internet.
Raw pictures can have non-efficient file names from the digital camera. This makes them hard to organize and list. Raw pictures can be huge in file size. This is a problem for storage, backup, transfer, upload and download. Raw pictures can contain hidden data from your camera, camera software and picture editing software. The hidden data can include automatic data, such as timestamps, face identification and software details. That can be a security problem.
Therefore, you might want to prepare raw pictures for sharing over the internet.
In the following example, we will prepare a number of raw pictures from a digital camera for sharing over the internet.
The pictures are rotated according to their orientation data in Exchangeable Image File Format (EXIF). The orientation data in EXIF is then reset. The pictures are renamed according to the timestamp in EXIF. The pictures will have their EXIF header removed for security reasons. All this is done using jhead, which a JPEG EXIF header manipulation tool, that is perfect for this task.
jhead -autorot -ft -nf%Y-%m-%d-%H-%M-%S -purejpg *.JPG
The pictures are resized. This makes them smaller in file size and makes them fit the target. In this example, we will prepare pictures for sharing on Facebook, which uses a maximum size of 720 pixels. This is done using mogrify, which is perfect command line processing tool for this task. mogrify is a part of ImageMagick. If the picture is horizontal, the picture is resized to a maximum width of 720 pixels. If the picture is vertical, the picture is resized to a maximum height of 720 pixels. The aspect ratio remains the same.
mogrify -resize 720x720 *.jpg
If needed, we can apply grey scaling and then a blue tint. This effect will make all pictures appear blue.
mogrify -modulate 100,0,100 -fill 'blue' -tint 25 *.jpg
If needed, we can add a watermark. In this example, we will set the font type to the Kompakt TrueType font, the font size to 36, the place to bottom right, the font outline color to white, the transparency to 30% (0.3), the font RGB color code to 200,0,200 (pink), the transparency to 30%, the location to 5,0 (a little more space to the right edge) and our website address as the watermark.
mogrify -font /usr/share/fonts/truetype/opentech/kompakt.ttf -pointsize 36 -draw "gravity southeast stroke rgba(255,255,255,0.3) fill rgba(200,0,200,0.3) text 5,0 'www.opentech.dk'" *.jpg
Open Tech SmbA can help your company automate picture and image processing. Contact Open Tech SmbA by mail at opentech@opentech.dk or call Open Tech SmbA at +45 43 62 22 88.
You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Comments are closed.