TranJPEG

User help notes


Contents

[ Introduction | Installation | Usage | The iconbar icon | Control window | Choices window | The status window | Screenshots | Contact | Changes ]

[ Licence ]

[ IJPG ReadMe document | IJPG Usage document ]


Introduction

TranJPEG is a WIMP front-end for the IJPG command-line utility 'jpegtran' and gives easy access to the features of the utility. It allows JPEG images to be transformed in a number of ways in a lossless process. See below for a list of the transformations currently supported by TranJPEG. The version of jpegtran currently supplied with TranJPEG is stable version 9d (released on 12-Jan-2020).


Installation

For a new installation, simply drag and drop the TranJPEG application into the directory of your choice.

If you have a previous copy of TranJPEG you have two choices.


Usage

TranJPEG is run in the usual way by double clicking on its icon. It will install on the icon bar.

The file, or selection of files, to be transformed should be dragged to TranJPEG, either to the iconbar icon, when the control window will open, or if the control window is already open, files may be dragged to it.

The selection of files can be added to by dragging further selections. In addition, if one or more folders are dragged, then TranJPEG will add any JPEG files in the folder to the list.

TranJPEG will NOT recurse down the directory structure, only JPEG files in the top level will be added to the filelist. This is by design, since it is easy to forget there might be other directories embedded in a dragged directory, and you end up transforming hundreds of images you didn't intend to.

TranJPEG uses a taskwindow to run the jpegtran binary, so the process essentially multitasks, and the machine remains usable during the batch processing. The task window is not normally visible during the conversion.


The iconbar icon

If a selection of JPEG files is dragged to the iconbar icon, these files will be added to the list of files to be processed. The control window will open automatically if not already open.

Clicking with SELECT (left mouse button) on the iconbar icon will open the control window.

Clicking with ADJUST (right mouse button) on the iconbar icon will open the settings/choices window.

The icon bar menu

Infoibarmenu.png
- 3026 bytes
Shows application information, including the version number, and also contains a Web button to check the download site for new versions. A web browser should have been booted for this to work.
Help...
Opens the html help file (this one).
Control...
Open the TranJPEG control window (see below). The control window can more easily be opened by clicking on the icon bar icon with SELECT.
Choices...
Open the TranJPEG choices window (see below). The choices window can more easily be opened by clicking on the icon bar icon with ADJUST.
Quit
Remove the application from the iconbar.

The control window

The control window is shown below.

conwin.png - 25Kb
Files to process
This shows the number of files waiting in the queue to be processed
Clear file list
Clicking this button allows the file list to be cleared if you change your mind about files in the list. It will clear the whole list.

The main part of the window controls the transformation actions that may be specified.

Optimise
If this is ticked then the entropy encoding parameters are optimised. If unticked, then default encoding parameters are used. Optimise usually makes the JPEG file a little smaller. Image quality is unaffected by optimising.
Progressive
If this is ticked then a progressive JPEG file is created. In this type of JPEG file, the data is stored in multiple scans of increasing quality. If the file is being transmitted over a slow communications link, the decoder can use the first scan to display a low-quality image very quickly, and can then improve the display with each subsequent scan. The final image is exactly equivalent to a standard JPEG file of the same quality setting, and the total file size is about the same.
Greyscale
This option discards the chrominance channels if the input image is YCbCr (ie, a standard color JPEG), resulting in a greyscale JPEG file. The luminance channel is preserved exactly, so this is a better method of reducing to greyscale than decompression, conversion, and recompression.
Strip EXIF data
When this is ticked, all EXIF data will be removed from each processed file. This option overrides the setting in the Settings window, and may be used either alone, or at the same time as other transforms.
Transform
If this is ticked, then the image will be transformed in one of a number of ways. The particular transformation to be used is selected using the group of radio buttons below the transform button. The transformations that are available are described below.
AUTO rotate
This option relies on
  • The image file containing valid exif data
  • The camera writing an 'orientation flag' into the exif data. This is sometimes a user setting, rather than a default action

TranJPEG will attempt to read the orientation flag from the exif data, and if successful, will rotate the image according to the setting of this flag. Images with no exif data, a 'normal orientation' flag, or no orientation flag will be ignored.

Rotate right
Click SELECT to rotate each of the images 90° to the right.
Rotate 180°
Click SELECT to rotate each of the images through 180°.
Rotate left
Click SELECT to rotate each of the images 90° to the left.
Flip horizontal
Click SELECT to flip each of the images left to right.
Flip vertical
Click SELECT to flip each of the images top to bottom.
Transpose
Click SELECT to transpose each of the images (across the upper left to lower right axis). This can be thought of as a rotation to the right followed by a reflection (flip) left to right.
Transverse
Click SELECT to carry out the transverse operation on each of the images (across the upper right to lower left axis). This can be thought of as a rotation to the left followed by a reflection (flip) left to right.
Smartscale
This results in a 'lossless' scaling. There are a limited range of options, which can be chosen using the menu button to the right. The scales available are
  • Scale up by a factor of 2
  • Reduce image size to one half
  • Reduce image size to one quarter
  • Reduce image size to one eighth
Currently there are not many RISC OS applications that understand and can display a smartscaled image.
Crop images
This will result in the lossless cropping of each image. The width and height of the image (in pixels) after cropping is entered, together with the X and Y offsets for the start of the cropped image (effectively the top-left coordinate). The X offset is the number of pixels in from the left side of the image. The Y offset is the number of pixels down from the top edge.

There are some caveats. The top-left coordinate of the cropping area must start at the top left of an iMCU block (block sizes are almost invariably 8 or 16 pixels). If this is not the case, jpegtran will move the top-left up and left so it does correspond. At the same time the width and height will be increased appropriately to keep the bottom-right of the area at the original position.

Destination of transformed file

Below the transformation buttons there is a means of specifying the destination of the transformed files.

Overwrite original file

If this option is ticked, then TranJPEG will use the input file path to save the transformed image. This means the original file will be overwritten with the newly transformed file. It is always wise to keep backups of the originals if this option is being used.

If this option is not ticked, then the following will apply.

Use save path

If Use save path is ticked then it is possible to specify the directory in which the transformed images are to be placed. This directory can be set in two ways.

If Use save path is NOT ticked then TranJPEG will put the transformed image into a directory (in the same location as the original image) named for the transformation, e.g. 'rotleft'. This is to prevent TranJPEG overwriting the original image.

Choices

At the foot of the window is a button Choices..., which will open the choices window allowing further options to be set. This is described in the next section. This window can also be opened by a right click on the iconbar icon, or from the iconbar icon menu.

Starting the processing

At the bottom right of the control window is the Process button. Clicking SELECT on this will start the batch process off. Assuming there are some JPEG files in the queue, the control window will close, and the status window will open. This is shown below.


The choices window

Clicking 'Choices...' in the control window, a right mouse click on the iconbar icon, or using the iconbar icon menu, will open a new dialogue and reveal more options. Any changes made will take effect immediately. If you wish them to become the default settings when TranJPEG is next run then Save should be pressed.

Trim non-transformable edge blocks
The following is taken from the Independent JPEG Group's documentation for jpegtran

The transpose transformation has no restrictions regarding image dimensions. The other transformations operate rather oddly if the image dimensions are not a multiple of the iMCU size (usually 8 or 16 pixels), because they can only transform complete blocks of DCT coefficient data in the desired way.

jpegtran's default behavior when transforming an odd-size image is designed to preserve exact reversibility and mathematical consistency of the transformation set. As stated, transpose is able to flip the entire image area. Horizontal mirroring leaves any partial iMCU column at the right edge untouched, but is able to flip all rows of the image. Similarly, vertical mirroring leaves any partial iMCU row at the bottom edge untouched, but is able to flip all columns. The other transforms can be built up as sequences of transpose and flip operations; for consistency, their actions on edge pixels are defined to be the same as the end result of the corresponding transpose-and-flip sequence.

For practical use, you may prefer to discard any untransformable edge pixels rather than having a strange-looking strip along the right and/or bottom edges of a transformed image.

Copying exif data
The three radio buttons control what jpegtran does with any exif data in the image file. You can choose to copy everything into the transformed image, only the exif comments, or nothing at all.

Neither TranJPEG nor jpegtran will modify the exif data in any other way. This means, for example, that the orientation data will remain the same. If the rotated image is then viewed in software that uses the orientation data, then it may rotate the image again (but see below under 'Write back orientation'). The thumbnail, if present, will still show the image in its original orientation.

Copy non-transformed images
If this is not ticked, then during auto-rotation with a save path set, only those images which actually require rotation will end up in the new location. If this option is ticked, then non-rotated images will be copied unchanged into the new location, so that a complete set of images will be produced.
Write back orientation
The auto-rotate option uses the orientation data in the exif header to return the image to a 'normal' orientation. However, any software that uses this orientation data to auto-rotate the image, e.g. for display, or even TranJPEG itself, will still rotate the image. If you write back the orientation as 'normal' then the image will not be rotated again. This write back will only work if all the exif data has been copied into the newly transformed image, although if the exif data has not been copied, then auto-rotation would not work anyway.
Retain original timestamp
When TranJPEG processes a file, the new file will normally be given the timestamp when it is saved. For some purposes it is useful to timestamp the new file with a time the same as that when the original file was created. If this option is ticked, then TranJPEG will read the original file time stamp, and once the transformed file has been saved, will reset the timestamp to that of the original file.

The status window

When the Process button is clicked, assuming there are some JPEG files in the queue, the control window will close, and the status window will open. This is shown below.

There are four display fields which show the progress of the processing. The total number of files to process, and the position in the queue of the current file are shown. The filename of the current file is also shown. There is also a field that shows the current operation being carried out.

The two buttons at the bottom allow some control over the taskwindow processing.

Pause
This will allow the current trransformation to be paused. The button text will change to Resume, and clicking on it again will result in the transformation being continued.
Stop
This will immediately terminate the current transformation. The transformed image file may be left in a partially processed state and should be deleted.

If there are more images waiting in the queue to be processed, TranJPEG will ask whether it should continue to process these remaining images, or abandon the whole process.

While the processing is proceeding, it is possible to close the status window. Clicking on the iconbar icon will reopen the status window, if the processing is still continuing. If the transforms have completed, then the control window will be opened on clicking the iconbar icon.

Once the transformation(s) have completed and you have more files to process you have the following options.


Screenshots

All the screen shots in these pages were obtained using Snapper, a versatile screen capture application.

Snapper is available from https://www.chris-johnson.org.uk/software/snap.html


Contact

All communication about TranJPEG should be directed to Chris Johnson (Email:chris@chris-johnson.org.uk). Suggestions for new features are always welcome.

Web sites

Chris Johnson's web site is at https://www.chris-johnson.org.uk/index.html, with his RISC OS software at https://www.chris-johnson.org.uk/software/index.html.


This document last modified on 17 Mar 2018

The TranJPEG front-end is © Chris Johnson, 2013