1

what is the best solution? I read about the IrfanView but there is JPG_TRANSFORM plugin and IrfanView Shell Extension. Which one should I use and is it available for the 64 bit IrfanView? Please could you provide the links what should I install?

  • @Heron What type of file are you dealing with? It is unclear to me if you are working with a lossy filetype or not. – osullic Jan 16 '19 at 15:55
  • Also, it seems to me that a large part of your confusion comes from not knowing what a "shell extension" is. Is that correct? – osullic Jan 16 '19 at 15:57
  • 2
    Possible duplicate of Does rotating a photo count as a destructive editing? – Michael C Jan 17 '19 at 11:30
  • 1
    @PatrickHughes there's an additional restriction that lossless JPEG rotation requires the image dimensions be a multiple of 8 or 16. JPEG blocks are built from 8x8 samples, unless there's chroma subsampling involved (which is often the case) which doubles the size of the chroma blocks. – Mark Ransom Jan 19 '19 at 5:21
  • 1
    @PatrickHughes PNG is a lossless format so you can do anything you want, except for rotations that aren't a multiple of 90 degrees. – Mark Ransom Jan 20 '19 at 0:55
6

One way to rotate a photo losslessly (without decoding/reencoding) it to change the EXIF data that specifies the rotation (this data is set by the camera, depending on its orientation when the picture was talken). This can be done with ExifTool:

exiftool -n -Orientation={n} TheImage.jpg

Where {n} is a number between 1 and 8 (some of these orientations are mirror views).

EXIF orientation

  • A bunch of software ignores EXIF rotation, for example web browsers. xanthir.com/etc/exif – Boris Nov 27 '19 at 22:24
  • @Boris Browsers (at least my FF61) abides to the EXIF orientation when they display the image outside of HTML, and there is a recent image-orientation: from-image; style for the <img> tag that does what you think. Don't we all love these undated authoritative-looking pages... – xenoid Nov 27 '19 at 23:03
  • Both Chrome and Firefox (I just checked) ignore the EXIF orientation if you include the image on an HTML page without the CSS snippet you mentioned. – Boris Nov 27 '19 at 23:16
3

IrfanView can indeed rotate JPEG images in a lossless way, and it indeed needs the JPG_TRANSFORM plugin to do that. Luckily that plugin is already included in a normal install of IrfanView. To check you have the plugin: go to Help -> Installed PlugIns and check if JPG_TRANSFORM.DLL is in the list.

The JPG_TRANSFORM plugin is available for both 32 and 64 bit versions of IrfanView.

To use the lossless rotation from within IrfanView: use "JPG Lossless rotation" in the Options menu (or press Shift+J); DON'T use "Rotate Left" and "Rotate Right" in the image menu: those are not lossless for JPG. You don't need the IrfanView Shell Extension for this.

You can install the IrfanView Shell Extension, which will show some IrfanView operations in de context menu that you see if you right-click a file in Windows Explorer. Apparantly that extension also provides access to the lossless JPG rotation.

1

exiftran can do that kind of thing. Here is a bit of blurb from its Debian/Ubuntu package:

Homepage: https://www.kraxel.org/blog/linux/fbida/

Description-en: digital camera JPEG image transformer

exiftran is a command line utility to transform digital camera JPEG images. It can do lossless rotations like jpegtran, but unlike jpegtran it can process multiple images at once, and it cares about the Exif data: it can rotate images automatically by checking the Exif orientation tag, it updates the Exif information (image dimensions/orientation) if needed, and it also rotates the Exif thumbnail.

0

Let's look at the question slightly differently as:

     **Where does Digital Loss Occur?**

The RAW sensor data is your starting point. It's not actually an image yet. Processing this data into a picture involves decisions and adjustments in how the individual sensor elements will be merged to form pixels and that will lose a bit, but this is unavoidable.

Now you have an image in Pixels. This digital image is almost always "Sharpened", and exposure adjusted. All of this will result in some loss, but the result is generally considered to be an improvement (if done correctly).

At this point you have a good digital picture in memory.

(The actual process is not this linear, but conceptually this works.)

Now you need a format to save your picture. There are may choices, but the key one here for your question is JPG. JPG creates a very high degree of compression to save space. JPG achieves this by what's called "Lossy Compression". The details are not important other than understanding that certain kinds of detail are lost in the compression.

Generally, all of the above takes place in your camera in a fraction of a second. The raw processing can be done outside the camera, but that's not important here.

 **Now we begin to get close to your actual question** 

Uncompressing (a.k.a. viewing the image) will not get back exactly the same image that existed prior to saving as a JPG, but now you are looking at it and potentially editing it as uncompressed pixels. Your edits will of course affect the image as desired, including rotating the picture. If you imagine the picture as a grid of pixels, rotating 90 degrees is just swapping rows and columns with no loss to any pixel. Addendum: Jpegtran does this by swapping jpeg cosine coefficients without actually uncompressing first.

          **The Heart of your question**

If you want to SAVE your changes, rotation in this instance, you have to chose a format. There are many loss-less formats available (TIF, PNG, others), with and without compression. Chose one of those and you're done, no loss rotation. If you SAVEAS a new JPG, additional losses will be introduced. That's just how lossy compression works.

There are utilities that pseudo rotate images by changing he orientation meta data in the JPG EXIF. That tells exif aware (some aren't) viewers to transpose pixel rows and columns without loss, but they never actually SAVE anything, avoiding the loss imposed by creating a new JPG.

Hopefully my ramble eventually answered your question?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.